profitbricks 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a0ff4bfe920209b641d343a04137b8a38d6ec43
4
- data.tar.gz: 396baa3f665ca3a526a60141a50115ae0acd96c8
3
+ metadata.gz: d9b9764ad2e524499c1c45274219ad62d1f5642e
4
+ data.tar.gz: 85fc09ceeb64652682551f1acc3434a4aac4b409
5
5
  SHA512:
6
- metadata.gz: 78788fb605f270e3af09dbd6831dfbc4b76b6bbe1adbcc9b0dd87f2c041ed7d3812d8aadfb3041255d34901b647ecb02ec6c393a8d299b2dd174e66c43072f03
7
- data.tar.gz: 8ff5a7e06ab96295d4e6492d0016f09fe42140f9de409ae632ade63d3038846b455e5cdda5fa1d3759e2705513305c7bc5ad3e64391077edbfe22f052a2e30a4
6
+ metadata.gz: 6c19e66e08af35556293a30f70d42331778f72403d6680a76eef06c7d96f45ea74e36c3eb5229763de794d551b9f2ab3f6b78e8d7b7d9fc42547ff417f980f4b
7
+ data.tar.gz: 04c7c861e13c1d9a3c2edb0595b6e4fe8e9ea85eaf4a97dfdffbd2a1727b601daeef28a8242b55b1a84b5eead82cb859fd8b6d4cadc509318198808c8dbddc91
data/lib/profitbricks.rb CHANGED
@@ -13,7 +13,7 @@ require 'profitbricks/firewall'
13
13
  require 'profitbricks/rule'
14
14
 
15
15
  module Profitbricks
16
- VERSION = '0.9.6'
16
+ VERSION = '0.9.7'
17
17
  end
18
18
 
19
19
  PB = Profitbricks
@@ -11,6 +11,8 @@ module Profitbricks
11
11
  attr_accessor :save_responses
12
12
  # Set to true to enable Savons request/response logging, default: false
13
13
  attr_accessor :log
14
+ # Set the polling interval in seconds for the Server#wait_for_running and DataCenter#wait_for_provisioning methods, default: 1
15
+ attr_accessor :polling_interval
14
16
  end
15
17
  end
16
- end
18
+ end
@@ -68,7 +68,7 @@ module Profitbricks
68
68
  # Blocks until the Data Center is provisioned
69
69
  def wait_for_provisioning
70
70
  while !self.provisioned?
71
- sleep 1
71
+ sleep Profitbricks::Config.polling_interval
72
72
  end
73
73
  end
74
74
 
@@ -87,10 +87,14 @@ module Profitbricks
87
87
  # Creates and saves a new, empty Virtual Data Center.
88
88
  #
89
89
  # @param [Hash] options
90
- # @option options [String] :name Name of the Virtual Data Center (can not start with or contain (@, /, \\, |, ", '))
90
+ # @option options [String] :name Name of the Virtual Data Center (can not start with or contain (@, /, \\, |, ", '))
91
+ # @option options [String] :region Select region to create the data center (NORTH_AMERICA, EUROPE, DEFAULT). If DEFAULT or empty, the Virtual Data Center will be created in the default region of the user
91
92
  # @return [DataCenter] The newly created Virtual Data Center
92
93
  def create(options)
93
- response = Profitbricks.request :create_data_center, "<dataCenterName>#{options[:name]}</dataCenterName>"
94
+ raise ArgumentError.new(":region has to be one of 'DEFAULT', 'NORTH_AMERICA', or 'EUROPE'") if options[:region] and !['DEFAULT', 'EUROPE', 'NORTH_AMERICA'].include? options[:region]
95
+ xml = "<dataCenterName>#{options[:name]}</dataCenterName>"
96
+ xml += get_xml_and_update_attributes options, [:region]
97
+ response = Profitbricks.request :create_data_center, xml
94
98
  self.find(:id => response.to_hash[:create_data_center_response][:return][:data_center_id] )
95
99
  end
96
100
 
@@ -6,6 +6,7 @@ module Profitbricks
6
6
  Profitbricks::Config.save_responses = false
7
7
  Profitbricks::Config.log = false
8
8
  Profitbricks::Config.global_classes = true
9
+ Profitbricks::Config.polling_interval = 1
9
10
  yield Profitbricks::Config
10
11
 
11
12
  Savon.configure do |config|
@@ -90,4 +91,4 @@ module Profitbricks
90
91
  end
91
92
  klass
92
93
  end
93
- end
94
+ end
@@ -50,7 +50,7 @@ module Profitbricks
50
50
  # Blocks until the Server is running
51
51
  def wait_for_running
52
52
  while !self.running?
53
- sleep 1
53
+ sleep Profitbricks::Config.polling_interval
54
54
  end
55
55
  end
56
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: profitbricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Sander