fog-brightbox 0.1.0.dev1 → 0.1.0.dev2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +7 -1
- data/fog-brightbox.gemspec +1 -1
- data/gemfiles/Gemfile.1.8.7 +6 -0
- data/lib/fog/brightbox/compute.rb +1 -0
- data/lib/fog/brightbox/compute/config.rb +23 -0
- data/lib/fog/brightbox/compute/shared.rb +26 -39
- data/lib/fog/brightbox/config.rb +125 -0
- data/lib/fog/brightbox/core.rb +1 -1
- data/lib/fog/brightbox/version.rb +1 -1
- data/spec/fog/brightbox/compute/config_spec.rb +40 -0
- data/spec/fog/brightbox/config_spec.rb +181 -0
- data/spec/fog/compute/brightbox_spec.rb +21 -0
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4400838c756e050e5c2b3c2bd6d401fc26d914ef
|
4
|
+
data.tar.gz: f0da830e257111042e5cbafc6863c73196cfe49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02335b2e9e290884a349f52f05d4fded3a63785846f0b744f23c4739ac539e779c24663f228eb6083a85bc95a0d33b8577ec9863ca50933c7afdb300ac1b8d5
|
7
|
+
data.tar.gz: 94c74114a0d84009ad5f6cb8fa361701fd7dbc36d80a5442f28e4cffab5e79c6a462d35c7335ebe3cbe82fbfdc5cc7c6862ce09ec879cdea0db0d26d2f526d0d
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
### 0.1.0.
|
1
|
+
### 0.1.0.dev2 / 2014-04-22
|
2
2
|
|
3
3
|
This PRERELEASE version may contain functionality that is removed before the
|
4
4
|
next release so all APIs should be considered unstable and you should lock
|
5
5
|
to the exact version if used!
|
6
6
|
|
7
|
+
Bug fixes:
|
8
|
+
|
9
|
+
* Reference fog-core-v1.22 rather than "master" branch now it is released.
|
10
|
+
|
11
|
+
### 0.1.0.dev1 / 2014-04-10
|
12
|
+
|
7
13
|
Enhancements:
|
8
14
|
|
9
15
|
* Add support for events feed
|
data/fog-brightbox.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "fog-core"
|
22
|
+
spec.add_dependency "fog-core", "~> 1.22"
|
23
23
|
spec.add_dependency "fog-json"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "delegate"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Brightbox
|
5
|
+
module Compute
|
6
|
+
class Config < SimpleDelegator
|
7
|
+
def initialize(config)
|
8
|
+
super
|
9
|
+
@config = config
|
10
|
+
raise ArgumentError unless required_args_available?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def required_args_available?
|
16
|
+
return false unless @config.client_id
|
17
|
+
return false unless @config.client_secret
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -17,49 +17,36 @@ module Fog
|
|
17
17
|
# @note If you create service using just a refresh token when it
|
18
18
|
# expires the service will no longer be able to authenticate.
|
19
19
|
#
|
20
|
-
# @
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# Account identifier to scope this connection to
|
35
|
-
# @option options [String] :connection_options
|
36
|
-
# Settings to pass to underlying {Fog::Core::Connection}
|
37
|
-
# @option options [Boolean] :persistent
|
38
|
-
# Sets a persistent HTTP {Fog::Core::Connection}
|
39
|
-
# @option options [String] :brightbox_access_token
|
40
|
-
# Sets the OAuth access token to use rather than requesting a new token
|
41
|
-
# @option options [String] :brightbox_refresh_token
|
42
|
-
# Sets the refresh token to use when requesting a newer access token
|
43
|
-
# @option options [String] (true) :brightbox_token_management
|
44
|
-
# Overide the existing behaviour to request access tokens if expired
|
45
|
-
#
|
46
|
-
def initialize(options)
|
20
|
+
# @see Fog::Brightbox::Config#initialize Config object for possible configuration options
|
21
|
+
#
|
22
|
+
# @param [Brightbox::Config, Hash] config
|
23
|
+
# Any configuration to be used for this service. This ideally should be in the newer form
|
24
|
+
# of a {Brightbox::Config} object but may be a Hash.
|
25
|
+
#
|
26
|
+
def initialize(config)
|
27
|
+
if config.respond_to?(:config_service?) && config.config_service?
|
28
|
+
@config = config
|
29
|
+
else
|
30
|
+
@config = Fog::Brightbox::Config.new(config)
|
31
|
+
end
|
32
|
+
@config = Fog::Brightbox::Compute::Config.new(@config)
|
33
|
+
|
47
34
|
# Currently authentication and api endpoints are the same but may change
|
48
|
-
@auth_url =
|
35
|
+
@auth_url = @config.auth_url.to_s
|
49
36
|
@auth_connection = Fog::Core::Connection.new(@auth_url)
|
50
37
|
|
51
|
-
@api_url =
|
52
|
-
@connection_options =
|
53
|
-
@persistent =
|
38
|
+
@api_url = @config.compute_url.to_s
|
39
|
+
@connection_options = @config.connection_options
|
40
|
+
@persistent = @config.connection_persistent?
|
54
41
|
@connection = Fog::Core::Connection.new(@api_url, @persistent, @connection_options)
|
55
42
|
|
56
43
|
# Authentication options
|
57
|
-
client_id =
|
58
|
-
client_secret =
|
44
|
+
client_id = @config.client_id
|
45
|
+
client_secret = @config.client_secret
|
59
46
|
|
60
|
-
username =
|
61
|
-
password =
|
62
|
-
@configured_account =
|
47
|
+
username = @config.username
|
48
|
+
password = @config.password
|
49
|
+
@configured_account = @config.account
|
63
50
|
# Request account can be changed at anytime and changes behaviour of future requests
|
64
51
|
@scoped_account = @configured_account
|
65
52
|
|
@@ -67,9 +54,9 @@ module Fog
|
|
67
54
|
@credentials = CredentialSet.new(client_id, client_secret, credential_options)
|
68
55
|
|
69
56
|
# If existing tokens have been cached, allow continued use of them in the service
|
70
|
-
@credentials.update_tokens(
|
57
|
+
@credentials.update_tokens(@config.cached_access_token, @config.cached_refresh_token)
|
71
58
|
|
72
|
-
@token_management =
|
59
|
+
@token_management = @config.managed_tokens?
|
73
60
|
end
|
74
61
|
|
75
62
|
# Sets the scoped account for future requests
|
@@ -172,7 +159,7 @@ module Fog
|
|
172
159
|
#
|
173
160
|
def default_image
|
174
161
|
return @default_image_id unless @default_image_id.nil?
|
175
|
-
@default_image_id =
|
162
|
+
@default_image_id = @config.default_image_id || select_default_image
|
176
163
|
end
|
177
164
|
|
178
165
|
private
|
@@ -0,0 +1,125 @@
|
|
1
|
+
module Fog
|
2
|
+
module Brightbox
|
3
|
+
# The {Fog::Brightbox::Config} class is designed to encapsulate a group of settings for reuse
|
4
|
+
# between Brightbox services. The same config can be used for any service.
|
5
|
+
#
|
6
|
+
# The config also holds the latest set of access tokens which when shared means when one service
|
7
|
+
# is told a token has expired then another will not retry it.
|
8
|
+
#
|
9
|
+
class Config
|
10
|
+
# Creates a new set of configuration settings based on the options provided.
|
11
|
+
#
|
12
|
+
# @param [Hash] options The configuration settings
|
13
|
+
# @option options [String] :brightbox_access_token
|
14
|
+
# Set to use a cached OAuth access token to avoid having to request new access rights.
|
15
|
+
# @option options [String] :brightbox_account
|
16
|
+
# Set to specify the account to scope requests to if relevant. API clients are limited to
|
17
|
+
# their owning accounts but users can access any account they collaborate on.
|
18
|
+
# @option options [String] :brightbox_api_url (https://api.gb1.brightbox.com)
|
19
|
+
# Set an alternative API endpoint to send requests to.
|
20
|
+
# @option options [String] :brightbox_auth_url (https://api.gb1.brightbox.com)
|
21
|
+
# Set an alternative OAuth authentication endpoint to send requests to.
|
22
|
+
# @option options [String] :brightbox_client_id
|
23
|
+
# Set to specify the client identifier to use for requests. Either +cli-12345+ or
|
24
|
+
# +app-12345+ are suitable settings.
|
25
|
+
# @option options [String] :brightbox_default_image
|
26
|
+
# Set to specify a preferred image to use by default in the Compute service.
|
27
|
+
# @option options [String] :brightbox_password
|
28
|
+
# Set to specify your user's password to authenticate yourself. This is independent of the
|
29
|
+
# client used to access the API.
|
30
|
+
# @option options [String] :brightbox_refresh_token
|
31
|
+
# Set to use a cached OAuth refresh token to avoid having to request new access rights.
|
32
|
+
# @option options [String] :brightbox_secret
|
33
|
+
# Set to specify the client secret to use for requests.
|
34
|
+
# @option options [String] :brightbox_token_management (true)
|
35
|
+
# Set to specify if the service should handle expired tokens or raise an error instead.
|
36
|
+
# @option options [String] :brightbox_username
|
37
|
+
# Set to specify your user account. Either user identifier (+usr-12345+) or email address
|
38
|
+
# may be used.
|
39
|
+
# @option options [String] :connection_options ({})
|
40
|
+
# Set to pass options through to the HTTP connection.
|
41
|
+
# @option options [Boolean] :persistent (false)
|
42
|
+
# Set to specify if the HTTP connection be persistent
|
43
|
+
#
|
44
|
+
# @example Use Fog.credentials
|
45
|
+
# # Assuming credentials are setup to return Brightbox settings and not other providers!
|
46
|
+
# @config = Fog::Brightbox::Config.new(Fog.credentials)
|
47
|
+
#
|
48
|
+
def initialize(options = {})
|
49
|
+
@options = options
|
50
|
+
end
|
51
|
+
|
52
|
+
# Can this be used to configure services? Yes, yes it can.
|
53
|
+
#
|
54
|
+
# @return [true]
|
55
|
+
def config_service?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_hash
|
60
|
+
@options
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [URI::HTTPS] A URI object for the authentication endpoint
|
64
|
+
def auth_url
|
65
|
+
URI.parse(@options.fetch(:brightbox_auth_url, "https://api.gb1.brightbox.com"))
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [URI::HTTPS] A URI object for the main API/compute service endpoint
|
69
|
+
def compute_url
|
70
|
+
URI.parse(@options.fetch(:brightbox_api_url, "https://api.gb1.brightbox.com"))
|
71
|
+
end
|
72
|
+
alias_method :api_url, :compute_url
|
73
|
+
|
74
|
+
# @return [String] The configured identifier of the API client or user application.
|
75
|
+
def client_id
|
76
|
+
@options[:brightbox_client_id]
|
77
|
+
end
|
78
|
+
|
79
|
+
# @return [String] The configured secret to use to identify the client.
|
80
|
+
def client_secret
|
81
|
+
@options[:brightbox_secret]
|
82
|
+
end
|
83
|
+
|
84
|
+
# @return [String] The configured email or user identified to use when accessing the API.
|
85
|
+
def username
|
86
|
+
@options[:brightbox_username]
|
87
|
+
end
|
88
|
+
|
89
|
+
# @return [String] The configured password to use to identify the user.
|
90
|
+
def password
|
91
|
+
@options[:brightbox_password]
|
92
|
+
end
|
93
|
+
|
94
|
+
# @return [String] The configured account identifier to scope API requests by.
|
95
|
+
def account
|
96
|
+
@options[:brightbox_account]
|
97
|
+
end
|
98
|
+
|
99
|
+
def connection_options
|
100
|
+
# These are pretty much passed through to the requests as is.
|
101
|
+
@options.fetch(:connection_options, {})
|
102
|
+
end
|
103
|
+
|
104
|
+
def connection_persistent?
|
105
|
+
@options.fetch(:persistent, false)
|
106
|
+
end
|
107
|
+
|
108
|
+
def cached_access_token
|
109
|
+
@options[:brightbox_access_token]
|
110
|
+
end
|
111
|
+
|
112
|
+
def cached_refresh_token
|
113
|
+
@options[:brightbox_refresh_token]
|
114
|
+
end
|
115
|
+
|
116
|
+
def managed_tokens?
|
117
|
+
@options.fetch(:brightbox_token_management, true)
|
118
|
+
end
|
119
|
+
|
120
|
+
def default_image_id
|
121
|
+
@options.fetch(:brightbox_default_image, nil)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/lib/fog/brightbox/core.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "fog/brightbox"
|
3
|
+
|
4
|
+
describe Fog::Brightbox::Compute::Config do
|
5
|
+
describe "when required arguments are included" do
|
6
|
+
it "nothing is raised" do
|
7
|
+
settings = {
|
8
|
+
:brightbox_client_id => "cli-12345",
|
9
|
+
:brightbox_secret => "1234567890"
|
10
|
+
}
|
11
|
+
config = Fog::Brightbox::Config.new(settings)
|
12
|
+
Fog::Brightbox::Compute::Config.new(config)
|
13
|
+
pass
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when client_id is not in configuration" do
|
18
|
+
it "raises ArgumentError" do
|
19
|
+
settings = {
|
20
|
+
:brightbox_secret => "1234567890"
|
21
|
+
}
|
22
|
+
config = Fog::Brightbox::Config.new(settings)
|
23
|
+
assert_raises ArgumentError do
|
24
|
+
Fog::Brightbox::Compute::Config.new(config)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when client_secret is not in configuration" do
|
30
|
+
it "raises ArgumentError" do
|
31
|
+
settings = {
|
32
|
+
:brightbox_client_id => "cli-12345"
|
33
|
+
}
|
34
|
+
config = Fog::Brightbox::Config.new(settings)
|
35
|
+
assert_raises ArgumentError do
|
36
|
+
Fog::Brightbox::Compute::Config.new(config)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "fog/brightbox"
|
3
|
+
|
4
|
+
describe Fog::Brightbox::Config do
|
5
|
+
it "can be used to config services" do
|
6
|
+
@config = Fog::Brightbox::Config.new
|
7
|
+
assert @config.config_service?
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "when created with Fog.credentials" do
|
11
|
+
it "does not error" do
|
12
|
+
@config = Fog::Brightbox::Config.new(Fog.credentials)
|
13
|
+
assert_instance_of Fog::Brightbox::Config, @config
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when created with a Hash" do
|
18
|
+
it "does not error" do
|
19
|
+
@options = {
|
20
|
+
:brightbox_client_id => "cli-12345"
|
21
|
+
}
|
22
|
+
@config = Fog::Brightbox::Config.new(@options)
|
23
|
+
assert_instance_of Fog::Brightbox::Config, @config
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "when auth url options was passed" do
|
28
|
+
it "returns the setting" do
|
29
|
+
@options = { :brightbox_auth_url => "https://api.gb1.brightbox.com" }
|
30
|
+
@config = Fog::Brightbox::Config.new(@options)
|
31
|
+
assert_instance_of URI::HTTPS, @config.auth_url
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "when auth url is not specified" do
|
36
|
+
it "returns the default" do
|
37
|
+
@config = Fog::Brightbox::Config.new({})
|
38
|
+
assert_instance_of URI::HTTPS, @config.auth_url
|
39
|
+
assert_equal "https://api.gb1.brightbox.com", @config.auth_url.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "when compute url options was passed" do
|
44
|
+
it "returns the setting" do
|
45
|
+
@options = { :brightbox_api_url => "https://api.gb1.brightbox.com" }
|
46
|
+
@config = Fog::Brightbox::Config.new(@options)
|
47
|
+
assert_instance_of URI::HTTPS, @config.compute_url
|
48
|
+
assert_equal @config.compute_url, @config.api_url
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "when compute url is not specified" do
|
53
|
+
it "returns the default" do
|
54
|
+
@config = Fog::Brightbox::Config.new({})
|
55
|
+
assert_instance_of URI::HTTPS, @config.compute_url
|
56
|
+
assert_equal "https://api.gb1.brightbox.com", @config.compute_url.to_s
|
57
|
+
assert_equal @config.compute_url, @config.api_url
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when client id is passed" do
|
62
|
+
it "returns the settings" do
|
63
|
+
@options = { :brightbox_client_id => "cli-12345" }
|
64
|
+
@config = Fog::Brightbox::Config.new(@options)
|
65
|
+
assert_equal "cli-12345", @config.client_id
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "when client secret is passed" do
|
70
|
+
it "returns the settings" do
|
71
|
+
@options = { :brightbox_secret => "secret" }
|
72
|
+
@config = Fog::Brightbox::Config.new(@options)
|
73
|
+
assert_equal "secret", @config.client_secret
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "when username is passed" do
|
78
|
+
it "returns the settings" do
|
79
|
+
@options = { :brightbox_username => "usr-12345" }
|
80
|
+
@config = Fog::Brightbox::Config.new(@options)
|
81
|
+
assert_equal "usr-12345", @config.username
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "when password is passed" do
|
86
|
+
it "returns the settings" do
|
87
|
+
@options = { :brightbox_password => "password" }
|
88
|
+
@config = Fog::Brightbox::Config.new(@options)
|
89
|
+
assert_equal "password", @config.password
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "when account is passed" do
|
94
|
+
it "returns the settings" do
|
95
|
+
@options = { :brightbox_account => "acc-12345" }
|
96
|
+
@config = Fog::Brightbox::Config.new(@options)
|
97
|
+
assert_equal "acc-12345", @config.account
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "when connection options are passed" do
|
102
|
+
it "returns the settings" do
|
103
|
+
@connection_settings = {
|
104
|
+
:headers => {
|
105
|
+
"Content-Type" => "application/json"
|
106
|
+
}
|
107
|
+
}
|
108
|
+
@options = {
|
109
|
+
:connection_options => @connection_settings
|
110
|
+
}
|
111
|
+
@config = Fog::Brightbox::Config.new(@options)
|
112
|
+
assert_equal @connection_settings, @config.connection_options
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "when no connection options were passed" do
|
117
|
+
it "returns an empty hash" do
|
118
|
+
@config = Fog::Brightbox::Config.new
|
119
|
+
assert_equal({}, @config.connection_options)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "when persistent connection is requested" do
|
124
|
+
it "returns true for the setting" do
|
125
|
+
@options = { :persistent => true }
|
126
|
+
@config = Fog::Brightbox::Config.new(@options)
|
127
|
+
assert @config.connection_persistent?
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "when persistent connection is not specified" do
|
132
|
+
it "returns false by default" do
|
133
|
+
@config = Fog::Brightbox::Config.new
|
134
|
+
refute @config.connection_persistent?
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "when cached OAuth tokens were passed" do
|
139
|
+
it "returns the settings" do
|
140
|
+
@access_token = "1234567890abcdefghijklmnopqrstuvwxyz"
|
141
|
+
@refresh_token = "1234567890abcdefghijklmnopqrstuvwxyz"
|
142
|
+
@options = {
|
143
|
+
:brightbox_access_token => @access_token,
|
144
|
+
:brightbox_refresh_token => @refresh_token
|
145
|
+
}
|
146
|
+
@config = Fog::Brightbox::Config.new(@options)
|
147
|
+
assert_equal @access_token, @config.cached_access_token
|
148
|
+
assert_equal @refresh_token, @config.cached_refresh_token
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "when token management is not specified" do
|
153
|
+
it "returns true by default" do
|
154
|
+
@config = Fog::Brightbox::Config.new
|
155
|
+
assert @config.managed_tokens?
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "when token management setting is disabled" do
|
160
|
+
it "returns false" do
|
161
|
+
@options = { :brightbox_token_management => false }
|
162
|
+
@config = Fog::Brightbox::Config.new(@options)
|
163
|
+
refute @config.managed_tokens?
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe "when a default server image is configured" do
|
168
|
+
it "returns the configured setting" do
|
169
|
+
@options = { :brightbox_default_image => "img-12345" }
|
170
|
+
@config = Fog::Brightbox::Config.new(@options)
|
171
|
+
assert_equal "img-12345", @config.default_image_id
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
describe "when a default server is not set" do
|
176
|
+
it "returns nil" do
|
177
|
+
@config = Fog::Brightbox::Config.new
|
178
|
+
assert_nil @config.default_image_id
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -46,4 +46,25 @@ describe Fog::Compute::Brightbox do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
describe "when created with a Config object" do
|
51
|
+
it "does not error" do
|
52
|
+
@options = {
|
53
|
+
:brightbox_client_id => "cli-12345",
|
54
|
+
:brightbox_secret => "1234567890"
|
55
|
+
}
|
56
|
+
@config = Fog::Brightbox::Config.new(@options)
|
57
|
+
@service = Fog::Compute::Brightbox.new(@config)
|
58
|
+
pass
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "when created with Config missing required settings" do
|
63
|
+
it "raises ArgumentError"do
|
64
|
+
@config = Fog::Brightbox::Config.new({})
|
65
|
+
assert_raises ArgumentError do
|
66
|
+
@service = Fog::Compute::Brightbox.new(@config)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
49
70
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-brightbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.dev2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Thornthwaite
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.22'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.22'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fog-json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,16 +88,20 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- CHANGELOG.md
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
95
96
|
- Rakefile
|
96
97
|
- fog-brightbox.gemspec
|
98
|
+
- gemfiles/Gemfile.1.8.7
|
97
99
|
- lib/fog/brightbox.rb
|
98
100
|
- lib/fog/brightbox/compute.rb
|
101
|
+
- lib/fog/brightbox/compute/config.rb
|
99
102
|
- lib/fog/brightbox/compute/image_selector.rb
|
100
103
|
- lib/fog/brightbox/compute/shared.rb
|
104
|
+
- lib/fog/brightbox/config.rb
|
101
105
|
- lib/fog/brightbox/core.rb
|
102
106
|
- lib/fog/brightbox/models/compute/account.rb
|
103
107
|
- lib/fog/brightbox/models/compute/accounts.rb
|
@@ -241,6 +245,8 @@ files:
|
|
241
245
|
- lib/fog/brightbox/requests/compute/update_server_group.rb
|
242
246
|
- lib/fog/brightbox/requests/compute/update_user.rb
|
243
247
|
- lib/fog/brightbox/version.rb
|
248
|
+
- spec/fog/brightbox/compute/config_spec.rb
|
249
|
+
- spec/fog/brightbox/config_spec.rb
|
244
250
|
- spec/fog/compute/brightbox_spec.rb
|
245
251
|
homepage: ''
|
246
252
|
licenses:
|
@@ -268,4 +274,6 @@ specification_version: 4
|
|
268
274
|
summary: This library can be used as a module for `fog` or as standalone provider
|
269
275
|
to use the Brightbox Cloud in applications
|
270
276
|
test_files:
|
277
|
+
- spec/fog/brightbox/compute/config_spec.rb
|
278
|
+
- spec/fog/brightbox/config_spec.rb
|
271
279
|
- spec/fog/compute/brightbox_spec.rb
|