fog-brightbox 1.10.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +20 -3
  3. data/.rubocop.yml +15 -10
  4. data/CHANGELOG.md +34 -0
  5. data/README.md +6 -0
  6. data/Rakefile +1 -1
  7. data/fog-brightbox.gemspec +9 -3
  8. data/lib/fog/brightbox/compute/shared.rb +11 -10
  9. data/lib/fog/brightbox/compute.rb +20 -21
  10. data/lib/fog/brightbox/config.rb +6 -9
  11. data/lib/fog/brightbox/models/compute/api_client.rb +4 -4
  12. data/lib/fog/brightbox/models/compute/application.rb +2 -2
  13. data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
  14. data/lib/fog/brightbox/models/compute/collaboration.rb +3 -3
  15. data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
  16. data/lib/fog/brightbox/models/compute/config_map.rb +2 -3
  17. data/lib/fog/brightbox/models/compute/database_server.rb +17 -5
  18. data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
  19. data/lib/fog/brightbox/models/compute/firewall_policy.rb +6 -6
  20. data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -9
  21. data/lib/fog/brightbox/models/compute/image.rb +9 -9
  22. data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -12
  23. data/lib/fog/brightbox/models/compute/server.rb +21 -23
  24. data/lib/fog/brightbox/models/compute/server_group.rb +6 -6
  25. data/lib/fog/brightbox/models/compute/user.rb +3 -3
  26. data/lib/fog/brightbox/models/compute/volume.rb +16 -16
  27. data/lib/fog/brightbox/models/storage/directories.rb +2 -2
  28. data/lib/fog/brightbox/models/storage/directory.rb +7 -7
  29. data/lib/fog/brightbox/models/storage/file.rb +13 -13
  30. data/lib/fog/brightbox/models/storage/files.rb +9 -13
  31. data/lib/fog/brightbox/oauth2.rb +13 -11
  32. data/lib/fog/brightbox/requests/compute/list_accounts.rb +1 -1
  33. data/lib/fog/brightbox/requests/compute/reset_database_server.rb +21 -0
  34. data/lib/fog/brightbox/requests/compute/resize_database_server.rb +25 -0
  35. data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +1 -1
  36. data/lib/fog/brightbox/requests/compute/snapshot_server.rb +1 -1
  37. data/lib/fog/brightbox/requests/storage/copy_object.rb +5 -5
  38. data/lib/fog/brightbox/requests/storage/delete_container.rb +3 -3
  39. data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -7
  40. data/lib/fog/brightbox/requests/storage/delete_object.rb +3 -3
  41. data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +6 -6
  42. data/lib/fog/brightbox/requests/storage/get_container.rb +4 -4
  43. data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -4
  44. data/lib/fog/brightbox/requests/storage/get_object.rb +4 -6
  45. data/lib/fog/brightbox/requests/storage/get_object_http_url.rb +1 -1
  46. data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +1 -1
  47. data/lib/fog/brightbox/requests/storage/head_container.rb +4 -4
  48. data/lib/fog/brightbox/requests/storage/head_containers.rb +4 -4
  49. data/lib/fog/brightbox/requests/storage/head_object.rb +3 -3
  50. data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +3 -3
  51. data/lib/fog/brightbox/requests/storage/put_container.rb +4 -4
  52. data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +4 -4
  53. data/lib/fog/brightbox/requests/storage/put_object.rb +7 -7
  54. data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +6 -6
  55. data/lib/fog/brightbox/storage/authentication_request.rb +4 -4
  56. data/lib/fog/brightbox/storage/connection.rb +2 -2
  57. data/lib/fog/brightbox/storage.rb +13 -14
  58. data/lib/fog/brightbox/version.rb +1 -1
  59. data/spec/fog/brightbox/compute/config_spec.rb +4 -4
  60. data/spec/fog/brightbox/compute/get_access_token_spec.rb +28 -28
  61. data/spec/fog/brightbox/compute/wrapped_request_spec.rb +23 -23
  62. data/spec/fog/brightbox/config_spec.rb +23 -23
  63. data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +2 -2
  64. data/spec/fog/brightbox/oauth2/credential_set_spec.rb +5 -5
  65. data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +2 -2
  66. data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +3 -3
  67. data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +4 -4
  68. data/spec/fog/brightbox/storage/authentication_request_spec.rb +41 -34
  69. data/spec/fog/brightbox/storage/config_spec.rb +4 -4
  70. data/spec/fog/brightbox/storage/connection_errors_spec.rb +6 -6
  71. data/spec/fog/brightbox/storage/connection_spec.rb +37 -37
  72. data/spec/fog/brightbox/storage/directory_spec.rb +6 -6
  73. data/spec/fog/brightbox/storage/files_spec.rb +5 -5
  74. data/spec/fog/brightbox/storage_spec.rb +5 -5
  75. data/spec/fog/compute/brightbox/database_server_spec.rb +19 -19
  76. data/spec/fog/compute/brightbox/image_selector_spec.rb +18 -18
  77. data/spec/fog/compute/brightbox/load_balancer_spec.rb +5 -5
  78. data/spec/fog/compute/brightbox/server_spec.rb +44 -44
  79. data/spec/fog/compute/brightbox/volume_spec.rb +68 -69
  80. data/spec/fog/compute/brightbox_spec.rb +16 -10
  81. data/spec/fog/storage/brightbox_spec.rb +83 -83
  82. data/spec/model_setup.rb +9 -9
  83. data/spec/stock_storage_responses.rb +9 -9
  84. data/spec/supports_resource_locking.rb +6 -6
  85. data/tests/brightbox/compute/schema.rb +74 -74
  86. data/tests/brightbox/compute_tests.rb +14 -14
  87. data/tests/brightbox/models/compute/account_tests.rb +0 -10
  88. data/tests/brightbox/models/compute/server_tests.rb +0 -1
  89. data/tests/brightbox/requests/compute/account_tests.rb +7 -21
  90. data/tests/brightbox/requests/compute/api_client_tests.rb +9 -9
  91. data/tests/brightbox/requests/compute/application_test.rb +8 -8
  92. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +11 -13
  93. data/tests/brightbox/requests/compute/collaboration_tests.rb +1 -1
  94. data/tests/brightbox/requests/compute/database_server_tests.rb +7 -7
  95. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +5 -5
  96. data/tests/brightbox/requests/compute/database_type_tests.rb +1 -1
  97. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -7
  98. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +8 -10
  99. data/tests/brightbox/requests/compute/helper.rb +1 -1
  100. data/tests/brightbox/requests/compute/image_tests.rb +2 -2
  101. data/tests/brightbox/requests/compute/interface_tests.rb +1 -1
  102. data/tests/brightbox/requests/compute/load_balancer_tests.rb +23 -23
  103. data/tests/brightbox/requests/compute/server_group_tests.rb +16 -18
  104. data/tests/brightbox/requests/compute/server_tests.rb +12 -12
  105. data/tests/brightbox/requests/compute/server_type_tests.rb +2 -2
  106. data/tests/brightbox/requests/compute/user_tests.rb +4 -4
  107. data/tests/brightbox/requests/compute/volume_tests.rb +5 -5
  108. data/tests/brightbox/requests/compute/zone_tests.rb +2 -2
  109. data/tests/helper.rb +1 -1
  110. data/tests/helpers/collection_helper.rb +16 -23
  111. data/tests/helpers/compute/server_helper.rb +4 -6
  112. data/tests/helpers/formats_helper.rb +5 -5
  113. data/tests/helpers/formats_helper_tests.rb +16 -16
  114. data/tests/helpers/mock_helper.rb +84 -86
  115. data/tests/helpers/model_helper.rb +1 -3
  116. data/tests/helpers/schema_validator_tests.rb +14 -14
  117. metadata +22 -7
  118. data/.rubocop_todo.yml +0 -81
@@ -25,12 +25,12 @@ module Fog
25
25
  # @see http://docs.brightbox.org/api/brightbox-object-storage/1.0/content/static-large-objects.html
26
26
  def delete_static_large_object(container, object, options = {})
27
27
  response = request({
28
- :expects => 200,
29
- :method => "DELETE",
30
- :headers => options.merge("Content-Type" => "text/plain",
31
- "Accept" => "application/json"),
32
- :path => "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}",
33
- :query => { "multipart-manifest" => "delete" }
28
+ expects: 200,
29
+ method: "DELETE",
30
+ headers: options.merge("Content-Type" => "text/plain",
31
+ "Accept" => "application/json"),
32
+ path: "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}",
33
+ query: { "multipart-manifest" => "delete" }
34
34
  }, false)
35
35
  response.body = Fog::JSON.decode(response.body)
36
36
  response
@@ -30,10 +30,10 @@ module Fog
30
30
  def get_container(container, options = {})
31
31
  options = options.reject { |_key, value| value.nil? }
32
32
  request(
33
- :expects => 200,
34
- :method => "GET",
35
- :path => Fog::Brightbox::Storage.escape(container),
36
- :query => { "format" => "json" }.merge!(options)
33
+ expects: 200,
34
+ method: "GET",
35
+ path: Fog::Brightbox::Storage.escape(container),
36
+ query: { "format" => "json" }.merge!(options)
37
37
  )
38
38
  end
39
39
  end
@@ -19,10 +19,10 @@ module Fog
19
19
  def get_containers(options = {})
20
20
  options = options.reject { |_key, value| value.nil? }
21
21
  request(
22
- :expects => [200, 204],
23
- :method => "GET",
24
- :path => "",
25
- :query => { "format" => "json" }.merge!(options)
22
+ expects: [200, 204],
23
+ method: "GET",
24
+ path: "",
25
+ query: { "format" => "json" }.merge!(options)
26
26
  )
27
27
  end
28
28
  end
@@ -10,14 +10,12 @@ module Fog
10
10
  #
11
11
  def get_object(container, object, &block)
12
12
  params = {
13
- :expects => 200,
14
- :method => "GET",
15
- :path => "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
13
+ expects: 200,
14
+ method: "GET",
15
+ path: "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
16
16
  }
17
17
 
18
- if block_given?
19
- params[:response_block] = block
20
- end
18
+ params[:response_block] = block if block_given?
21
19
 
22
20
  request(params, false)
23
21
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  # * response<~Excon::Response>:
14
14
  # * body<~String> - url for object
15
15
  def get_object_http_url(container, object, expires, options = {})
16
- create_temp_url(container, object, expires, "GET", options.merge(:scheme => "http"))
16
+ create_temp_url(container, object, expires, "GET", options.merge(scheme: "http"))
17
17
  end
18
18
  end
19
19
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  # * response<~Excon::Response>:
14
14
  # * body<~String> - url for object
15
15
  def get_object_https_url(container, object, expires, options = {})
16
- create_temp_url(container, object, expires, "GET", options.merge(:scheme => "https"))
16
+ create_temp_url(container, object, expires, "GET", options.merge(scheme: "https"))
17
17
  end
18
18
  end
19
19
  end
@@ -14,10 +14,10 @@ module Fog
14
14
  # * 'X-Container-Bytes-Used'<~String> - Bytes used
15
15
  def head_container(container)
16
16
  request(
17
- :expects => 204,
18
- :method => "HEAD",
19
- :path => Fog::Brightbox::Storage.escape(container),
20
- :query => { "format" => "json" }
17
+ expects: 204,
18
+ method: "HEAD",
19
+ path: Fog::Brightbox::Storage.escape(container),
20
+ query: { "format" => "json" }
21
21
  )
22
22
  end
23
23
  end
@@ -11,10 +11,10 @@ module Fog
11
11
  # * 'X-Account-Bytes-Used'<~String> - Bytes used
12
12
  def head_containers
13
13
  request(
14
- :expects => 204,
15
- :method => "HEAD",
16
- :path => "",
17
- :query => { "format" => "json" }
14
+ expects: 204,
15
+ method: "HEAD",
16
+ path: "",
17
+ query: { "format" => "json" }
18
18
  )
19
19
  end
20
20
  end
@@ -10,9 +10,9 @@ module Fog
10
10
  #
11
11
  def head_object(container, object)
12
12
  request({
13
- :expects => 200,
14
- :method => "HEAD",
15
- :path => "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
13
+ expects: 200,
14
+ method: "HEAD",
15
+ path: "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
16
16
  }, false)
17
17
  end
18
18
  end
@@ -22,9 +22,9 @@ module Fog
22
22
  # http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Account_Metadata-d1a4460.html
23
23
  def post_set_meta_temp_url_key(key)
24
24
  request(
25
- :expects => [201, 202, 204],
26
- :method => "POST",
27
- :headers => { "X-Account-Meta-Temp-Url-Key" => key }
25
+ expects: [201, 202, 204],
26
+ method: "POST",
27
+ headers: { "X-Account-Meta-Temp-Url-Key" => key }
28
28
  )
29
29
  end
30
30
  end
@@ -13,10 +13,10 @@ module Fog
13
13
  headers["X-Container-Write"] ||= options.delete(:write_permissions)
14
14
 
15
15
  request(
16
- :expects => [201, 202],
17
- :method => "PUT",
18
- :path => Fog::Brightbox::Storage.escape(name),
19
- :headers => headers
16
+ expects: [201, 202],
17
+ method: "PUT",
18
+ path: Fog::Brightbox::Storage.escape(name),
19
+ headers: headers
20
20
  )
21
21
  end
22
22
  end
@@ -29,10 +29,10 @@ module Fog
29
29
  path = "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
30
30
  headers = { "X-Object-Manifest" => path }.merge(options)
31
31
  request(
32
- :expects => 201,
33
- :headers => headers,
34
- :method => "PUT",
35
- :path => path
32
+ expects: 201,
33
+ headers: headers,
34
+ method: "PUT",
35
+ path: path
36
36
  )
37
37
  end
38
38
  end
@@ -17,20 +17,20 @@ module Fog
17
17
  #
18
18
  def put_object(container, object, data, options = {}, &block)
19
19
  if block_given?
20
- params = { :request_block => block }
20
+ params = { request_block: block }
21
21
  headers = options
22
22
  else
23
23
  data = Fog::Storage.parse_data(data)
24
24
  headers = data[:headers].merge!(options)
25
- params = { :body => data[:body] }
25
+ params = { body: data[:body] }
26
26
  end
27
27
 
28
28
  params.merge!(
29
- :expects => 201,
30
- :idempotent => !params[:request_block],
31
- :headers => headers,
32
- :method => "PUT",
33
- :path => "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
29
+ expects: 201,
30
+ idempotent: !params[:request_block],
31
+ headers: headers,
32
+ method: "PUT",
33
+ path: "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}"
34
34
  )
35
35
 
36
36
  request(params)
@@ -41,12 +41,12 @@ module Fog
41
41
  # @see http://docs.brightbox.org/api/brightbox-object-storage/1.0/content/static-large-objects.html
42
42
  def put_static_obj_manifest(container, object, segments, options = {})
43
43
  request(
44
- :expects => 201,
45
- :method => "PUT",
46
- :headers => options,
47
- :body => Fog::JSON.encode(segments),
48
- :path => "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}",
49
- :query => { "multipart-manifest" => "put" }
44
+ expects: 201,
45
+ method: "PUT",
46
+ headers: options,
47
+ body: Fog::JSON.encode(segments),
48
+ path: "#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object)}",
49
+ query: { "multipart-manifest" => "put" }
50
50
  )
51
51
  end
52
52
  end
@@ -25,10 +25,10 @@ module Fog
25
25
  authentication_url = URI.parse(@config.storage_url.to_s)
26
26
  connection = Fog::Core::Connection.new(authentication_url.to_s)
27
27
  request_settings = {
28
- :expects => [200, 204],
29
- :headers => auth_headers,
30
- :method => "GET",
31
- :path => "v1"
28
+ expects: [200, 204],
29
+ headers: auth_headers,
30
+ method: "GET",
31
+ path: "v1"
32
32
  }
33
33
  connection.request(request_settings)
34
34
  end
@@ -16,8 +16,8 @@ module Fog
16
16
  begin
17
17
  raise ArgumentError if params.nil?
18
18
  request_params = params.merge(
19
- :headers => request_headers(params),
20
- :path => path_in_params(params)
19
+ headers: request_headers(params),
20
+ path: path_in_params(params)
21
21
  )
22
22
  response = @connection.request(request_params)
23
23
  rescue Excon::Errors::Unauthorized => error
@@ -44,17 +44,16 @@ module Fog
44
44
  request :put_static_obj_manifest
45
45
 
46
46
  class Mock
47
- def initialize(_options = {})
48
- end
47
+ def initialize(_options = {}); end
49
48
  end
50
49
 
51
50
  class Real
52
51
  def initialize(config)
53
- if config.respond_to?(:config_service?) && config.config_service?
54
- @config = config
55
- else
56
- @config = Fog::Brightbox::Config.new(config)
57
- end
52
+ @config = if config.respond_to?(:config_service?) && config.config_service?
53
+ config
54
+ else
55
+ Fog::Brightbox::Config.new(config)
56
+ end
58
57
  @config = Fog::Brightbox::Storage::Config.new(@config)
59
58
 
60
59
  @temp_url_key = @config.storage_temp_key
@@ -152,9 +151,9 @@ module Fog
152
151
  raise ArgumentError, "Storage must be instantiated with the :brightbox_temp_url_key option" if @config.storage_temp_key.nil?
153
152
 
154
153
  # POST not allowed
155
- allowed_methods = %w(GET PUT HEAD)
154
+ allowed_methods = %w[GET PUT HEAD]
156
155
  unless allowed_methods.include?(method)
157
- raise ArgumentError.new("Invalid method '#{method}' specified. Valid methods are: #{allowed_methods.join(", ")}")
156
+ raise ArgumentError, "Invalid method '#{method}' specified. Valid methods are: #{allowed_methods.join(', ')}"
158
157
  end
159
158
 
160
159
  if management_url.nil?
@@ -168,7 +167,7 @@ module Fog
168
167
  destination_url.scheme = options[:scheme] if options[:scheme]
169
168
  destination_url.port = options[:port] if options[:port]
170
169
 
171
- object_path_escaped = "#{object_path}/#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object, "/")}"
170
+ object_path_escaped = "#{object_path}/#{Fog::Brightbox::Storage.escape(container)}/#{Fog::Brightbox::Storage.escape(object, '/')}"
172
171
  object_path_unescaped = "#{object_path}/#{Fog::Brightbox::Storage.escape(container)}/#{object}"
173
172
 
174
173
  expiry_timestamp = expires_at.to_i
@@ -178,18 +177,18 @@ module Fog
178
177
  sig = sig_to_hex(hmac.sign(string_to_sign))
179
178
 
180
179
  destination_url.path = object_path_escaped
181
- destination_url.query = URI.encode_www_form(:temp_url_sig => sig, :temp_url_expires => expiry_timestamp)
180
+ destination_url.query = URI.encode_www_form(temp_url_sig: sig, temp_url_expires: expiry_timestamp)
182
181
  destination_url.to_s
183
182
  end
184
183
 
185
184
  private
186
185
 
187
186
  def sig_to_hex(str)
188
- str.unpack("C*").map { |c|
187
+ str.unpack("C*").map do |c|
189
188
  c.to_s(16)
190
- }.map { |h|
189
+ end.map do |h|
191
190
  h.size == 1 ? "0#{h}" : h
192
- }.join
191
+ end.join
193
192
  end
194
193
 
195
194
  def update_config_from_auth_response(response)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "1.10.0"
3
+ VERSION = "1.12.0".freeze
4
4
  end
5
5
  end
@@ -4,8 +4,8 @@ describe Fog::Brightbox::Compute::Config do
4
4
  describe "when required arguments are included" do
5
5
  it "nothing is raised" do
6
6
  settings = {
7
- :brightbox_client_id => "cli-12345",
8
- :brightbox_secret => "1234567890"
7
+ brightbox_client_id: "cli-12345",
8
+ brightbox_secret: "1234567890"
9
9
  }
10
10
  config = Fog::Brightbox::Config.new(settings)
11
11
  Fog::Brightbox::Compute::Config.new(config)
@@ -16,7 +16,7 @@ describe Fog::Brightbox::Compute::Config do
16
16
  describe "when client_id is not in configuration" do
17
17
  it "raises ArgumentError" do
18
18
  settings = {
19
- :brightbox_secret => "1234567890"
19
+ brightbox_secret: "1234567890"
20
20
  }
21
21
  config = Fog::Brightbox::Config.new(settings)
22
22
  assert_raises ArgumentError do
@@ -28,7 +28,7 @@ describe Fog::Brightbox::Compute::Config do
28
28
  describe "when client_secret is not in configuration" do
29
29
  it "raises ArgumentError" do
30
30
  settings = {
31
- :brightbox_client_id => "cli-12345"
31
+ brightbox_client_id: "cli-12345"
32
32
  }
33
33
  config = Fog::Brightbox::Config.new(settings)
34
34
  assert_raises ArgumentError do
@@ -238,7 +238,7 @@ describe Fog::Brightbox::Compute, "#get_access_token" do
238
238
  # @param auth_correct [Boolean] Treat username/password as correct
239
239
  # @param two_factor_user [Boolean] Is user protected by 2FA on server
240
240
  # @param otp_sent [Boolean] Is an OTP sent in the request?
241
- def stub_authentication_request(auth_correct:,
241
+ def stub_authentication_request(auth_correct: true,
242
242
  two_factor_user: false,
243
243
  otp_sent: nil)
244
244
 
@@ -247,7 +247,7 @@ describe Fog::Brightbox::Compute, "#get_access_token" do
247
247
  request = {
248
248
  headers: {
249
249
  "Authorization" => "Basic YXBwLTEyMzQ1OjEyMzQ1Njc4OTA=",
250
- "Content-Type" => "application/json",
250
+ "Content-Type" => "application/json"
251
251
  },
252
252
  body: {
253
253
  grant_type: "password",
@@ -271,32 +271,32 @@ describe Fog::Brightbox::Compute, "#get_access_token" do
271
271
  # * User does use 2FA and FAILS to send OTP
272
272
  #
273
273
  response = if two_factor_user && !otp_sent
274
- # OTP required header
275
- {
276
- status: 401,
277
- headers: {
278
- "X-Brightbox-OTP" => "required"
279
- },
280
- body: { error: "invalid_client" }.to_json
281
- }
282
- elsif !auth_correct
283
- # No OTP header
284
- {
285
- status: 401,
286
- headers: {},
287
- body: { error: "invalid_client" }.to_json
288
- }
289
- else
290
- {
291
- status: 200,
292
- headers: {},
293
- body: {
294
- access_token: @new_access_token,
295
- refresh_token: @new_refresh_token,
296
- expires_in: 7200
297
- }.to_json
298
- }
299
- end
274
+ # OTP required header
275
+ {
276
+ status: 401,
277
+ headers: {
278
+ "X-Brightbox-OTP" => "required"
279
+ },
280
+ body: { error: "invalid_client" }.to_json
281
+ }
282
+ elsif !auth_correct
283
+ # No OTP header
284
+ {
285
+ status: 401,
286
+ headers: {},
287
+ body: { error: "invalid_client" }.to_json
288
+ }
289
+ else
290
+ {
291
+ status: 200,
292
+ headers: {},
293
+ body: {
294
+ access_token: @new_access_token,
295
+ refresh_token: @new_refresh_token,
296
+ expires_in: 7200
297
+ }.to_json
298
+ }
299
+ end
300
300
 
301
301
  stub_request(:post, "https://api.gb1.brightbox.com/token")
302
302
  .with(request)
@@ -5,20 +5,20 @@ describe Fog::Brightbox::Compute do
5
5
  describe "when nested option passed as true" do
6
6
  before do
7
7
  @options = {
8
- :brightbox_client_id => "cli-12345",
9
- :brightbox_secret => "1234567890",
10
- :brightbox_access_token => "TESTVALUE"
8
+ brightbox_client_id: "cli-12345",
9
+ brightbox_secret: "1234567890",
10
+ brightbox_access_token: "TESTVALUE"
11
11
  }
12
12
  @service = Fog::Brightbox::Compute.new(@options)
13
13
  end
14
14
 
15
15
  it "makes correct request" do
16
- stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts").
17
- with(:headers => {'Authorization'=>'Bearer TESTVALUE'},
18
- :query => { :nested => "true" }).
19
- to_return(:status => 200, :body => "", :headers => {})
16
+ stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts")
17
+ .with(headers: { "Authorization" => "Bearer TESTVALUE" },
18
+ query: { nested: "true" })
19
+ .to_return(status: 200, body: "", headers: {})
20
20
 
21
- @service.wrapped_request("get", "/1.0/accounts", [200], :nested => "true")
21
+ @service.wrapped_request("get", "/1.0/accounts", [200], nested: "true")
22
22
  pass
23
23
  end
24
24
  end
@@ -26,20 +26,20 @@ describe Fog::Brightbox::Compute do
26
26
  describe "when nested option passed as false" do
27
27
  before do
28
28
  @options = {
29
- :brightbox_client_id => "cli-12345",
30
- :brightbox_secret => "1234567890",
31
- :brightbox_access_token => "TESTVALUE"
29
+ brightbox_client_id: "cli-12345",
30
+ brightbox_secret: "1234567890",
31
+ brightbox_access_token: "TESTVALUE"
32
32
  }
33
33
  @service = Fog::Brightbox::Compute.new(@options)
34
34
  end
35
35
 
36
36
  it "makes correct request" do
37
- stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts").
38
- with(:headers => {'Authorization'=>'Bearer TESTVALUE'},
39
- :query => { :nested => "false" }).
40
- to_return(:status => 200, :body => "", :headers => {})
37
+ stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts")
38
+ .with(headers: { "Authorization" => "Bearer TESTVALUE" },
39
+ query: { nested: "false" })
40
+ .to_return(status: 200, body: "", headers: {})
41
41
 
42
- @service.wrapped_request("get", "/1.0/accounts", [200], :nested => "false")
42
+ @service.wrapped_request("get", "/1.0/accounts", [200], nested: "false")
43
43
  pass
44
44
  end
45
45
  end
@@ -47,18 +47,18 @@ describe Fog::Brightbox::Compute do
47
47
  describe "when nested option not passed" do
48
48
  before do
49
49
  @options = {
50
- :brightbox_client_id => "cli-12345",
51
- :brightbox_secret => "1234567890",
52
- :brightbox_access_token => "TESTVALUE"
50
+ brightbox_client_id: "cli-12345",
51
+ brightbox_secret: "1234567890",
52
+ brightbox_access_token: "TESTVALUE"
53
53
  }
54
54
  @service = Fog::Brightbox::Compute.new(@options)
55
55
  end
56
56
 
57
57
  it "makes correct request" do
58
- stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts").
59
- with(:headers => {'Authorization'=>'Bearer TESTVALUE'},
60
- :query => {}).
61
- to_return(:status => 200, :body => "", :headers => {})
58
+ stub_request(:get, "https://api.gb1.brightbox.com/1.0/accounts")
59
+ .with(headers: { "Authorization" => "Bearer TESTVALUE" },
60
+ query: {})
61
+ .to_return(status: 200, body: "", headers: {})
62
62
 
63
63
  @service.wrapped_request("get", "/1.0/accounts", [200])
64
64
  pass