Permalink
Browse files

! DataCenter.create now excepts a Hash

  • Loading branch information...
dsander committed Apr 11, 2012
1 parent fbc2745 commit ba75a834e008e3e8a2664a0f6b11dfc25e695362
Showing with 6 additions and 5 deletions.
  1. +1 −1 examples/create_datacenter.rb
  2. +4 −3 lib/profitbricks/data_center.rb
  3. +1 −1 spec/profitbricks/data_center_spec.rb
@@ -13,7 +13,7 @@
# * and a database server
#
-dc = DataCenter.create('Example Project')
+dc = DataCenter.create(:name => 'Example Project')
dc.wait_for_provisioning
debian = Image.find(:name => "profitbricks-debian-squeeze-EN-6.0.1a-amd64.img")
@@ -75,10 +75,11 @@ def all
# Creates and saves a new, empty Virtual Data Center.
#
- # @param [String] Name of the Virtual Data Center (can not start with or contain (@, /, \\, |, ", '))
+ # @param [Hash] options
+ # @option options [String] :name Name of the Virtual Data Center (can not start with or contain (@, /, \\, |, ", '))
# @return [DataCenter] The newly created Virtual Data Center
- def create(name)
- response = Profitbricks.request :create_data_center, "<dataCenterName>#{name}</dataCenterName>"
+ def create(options)
+ response = Profitbricks.request :create_data_center, "<dataCenterName>#{options[:name]}</dataCenterName>"
self.find(:id => response.to_hash[:create_data_center_response][:return][:data_center_id] )
end
@@ -6,7 +6,7 @@
it "should create a new datacenter" do
savon.expects(:create_data_center).returns(:success)
savon.expects(:get_data_center).returns(:create)
- dc = DataCenter.create('Test2')
+ dc = DataCenter.create(:name => 'Test2')
dc.name.should == 'Test2'
dc.id.should == "b3eebede-5c78-417c-b1bc-ff5de01a0602"
dc.version.should == 9

0 comments on commit ba75a83

Please sign in to comment.