fog-brightbox 0.1.0.dev2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -2
  3. data/Rakefile +1 -0
  4. data/fog-brightbox.gemspec +3 -0
  5. data/lib/fog/brightbox/model.rb +10 -0
  6. data/lib/fog/brightbox/model_helper.rb +15 -0
  7. data/lib/fog/brightbox/models/compute/account.rb +2 -5
  8. data/lib/fog/brightbox/models/compute/api_client.rb +3 -1
  9. data/lib/fog/brightbox/models/compute/application.rb +2 -2
  10. data/lib/fog/brightbox/models/compute/cloud_ip.rb +2 -2
  11. data/lib/fog/brightbox/models/compute/collaboration.rb +2 -2
  12. data/lib/fog/brightbox/models/compute/database_server.rb +2 -2
  13. data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
  14. data/lib/fog/brightbox/models/compute/database_type.rb +2 -2
  15. data/lib/fog/brightbox/models/compute/event.rb +3 -3
  16. data/lib/fog/brightbox/models/compute/firewall_policy.rb +2 -3
  17. data/lib/fog/brightbox/models/compute/firewall_rule.rb +2 -5
  18. data/lib/fog/brightbox/models/compute/flavor.rb +2 -5
  19. data/lib/fog/brightbox/models/compute/image.rb +2 -4
  20. data/lib/fog/brightbox/models/compute/load_balancer.rb +2 -3
  21. data/lib/fog/brightbox/models/compute/server.rb +3 -2
  22. data/lib/fog/brightbox/models/compute/server_group.rb +2 -3
  23. data/lib/fog/brightbox/models/compute/user.rb +2 -5
  24. data/lib/fog/brightbox/models/compute/user_collaboration.rb +2 -2
  25. data/lib/fog/brightbox/models/compute/zone.rb +2 -6
  26. data/lib/fog/brightbox/requests/compute/accept_user_collaboration.rb +1 -1
  27. data/lib/fog/brightbox/requests/compute/create_collaboration.rb +3 -1
  28. data/lib/fog/brightbox/requests/compute/create_database_server.rb +1 -0
  29. data/lib/fog/brightbox/requests/compute/create_load_balancer.rb +2 -0
  30. data/lib/fog/brightbox/requests/compute/get_collaboration.rb +1 -1
  31. data/lib/fog/brightbox/requests/compute/get_user_collaboration.rb +1 -1
  32. data/lib/fog/brightbox/requests/compute/list_collaborations.rb +1 -1
  33. data/lib/fog/brightbox/requests/compute/list_events.rb +9 -2
  34. data/lib/fog/brightbox/requests/compute/reject_user_collaboration.rb +1 -1
  35. data/lib/fog/brightbox/requests/compute/update_load_balancer.rb +2 -0
  36. data/lib/fog/brightbox/requests/compute/update_server.rb +0 -1
  37. data/lib/fog/brightbox/version.rb +1 -1
  38. data/spec/fog/brightbox/compute/config_spec.rb +1 -2
  39. data/spec/fog/brightbox/config_spec.rb +1 -2
  40. data/spec/fog/compute/brightbox/account_spec.rb +20 -0
  41. data/spec/fog/compute/brightbox/api_client_spec.rb +20 -0
  42. data/spec/fog/compute/brightbox/application_spec.rb +20 -0
  43. data/spec/fog/compute/brightbox/cloud_ip_spec.rb +20 -0
  44. data/spec/fog/compute/brightbox/collaboration_spec.rb +20 -0
  45. data/spec/fog/compute/brightbox/database_server_spec.rb +20 -0
  46. data/spec/fog/compute/brightbox/database_snapshot_spec.rb +20 -0
  47. data/spec/fog/compute/brightbox/database_type_spec.rb +20 -0
  48. data/spec/fog/compute/brightbox/event_spec.rb +20 -0
  49. data/spec/fog/compute/brightbox/firewall_policy_spec.rb +20 -0
  50. data/spec/fog/compute/brightbox/flavor_spec.rb +20 -0
  51. data/spec/fog/compute/brightbox/image_spec.rb +20 -0
  52. data/spec/fog/compute/brightbox/load_balancer_spec.rb +20 -0
  53. data/spec/fog/compute/brightbox/server_group_spec.rb +20 -0
  54. data/spec/fog/compute/brightbox/server_spec.rb +20 -0
  55. data/spec/fog/compute/brightbox/user_collaboration_spec.rb +20 -0
  56. data/spec/fog/compute/brightbox/user_spec.rb +20 -0
  57. data/spec/fog/compute/brightbox/zone_spec.rb +20 -0
  58. data/spec/fog/compute/brightbox_spec.rb +1 -2
  59. data/spec/model_helper.rb +22 -0
  60. data/spec/spec_helper.rb +3 -0
  61. metadata +88 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4400838c756e050e5c2b3c2bd6d401fc26d914ef
4
- data.tar.gz: f0da830e257111042e5cbafc6863c73196cfe49a
3
+ metadata.gz: b5e5f470b25b982e96e2662963afa39418239a13
4
+ data.tar.gz: f4d58842d9abd798b56634cb505b7f225ab0914b
5
5
  SHA512:
6
- metadata.gz: b02335b2e9e290884a349f52f05d4fded3a63785846f0b744f23c4739ac539e779c24663f228eb6083a85bc95a0d33b8577ec9863ca50933c7afdb300ac1b8d5
7
- data.tar.gz: 94c74114a0d84009ad5f6cb8fa361701fd7dbc36d80a5442f28e4cffab5e79c6a462d35c7335ebe3cbe82fbfdc5cc7c6862ce09ec879cdea0db0d26d2f526d0d
6
+ metadata.gz: 8c6971aa099ad1c2407b4c667d3c1176ebd28d58a3b8cbbabd4c82a7973e18e35216b7952464771942fbde133ee0ae67cd54e0f7d74df7748a204fb11ea73658
7
+ data.tar.gz: 530c147b9cef85841e7f29380e59f12993fc3b1100fdf28e67ab6c370e8c709363c5f79e07720be29c8ed530f88d539243896c8969eadfd6bb21eab46d4c5f0e
@@ -1,7 +1,25 @@
1
+ ### 0.1.0 / 2014-06-25
2
+
3
+ Enhancements:
4
+
5
+ * Add `pry` as a development dependency so available under Bundler
6
+ * Add `spec_helper` to DRY out requires on start of tests
7
+ * Add `Fog::Brightbox::Model` layer to add shared functionality between models
8
+ * Add `#resource_name` and `#collection_name` inflection methods to models
9
+ * Add basic specs for models
10
+
11
+ Changes:
12
+
13
+ * Update generated documentation for requests
14
+
15
+ Bug fixes:
16
+
17
+ * Fix `rake:spec` task to add "spec" to LOAD_PATH
18
+
1
19
  ### 0.1.0.dev2 / 2014-04-22
2
20
 
3
- This PRERELEASE version may contain functionality that is removed before the
4
- next release so all APIs should be considered unstable and you should lock
21
+ This PRERELEASE version may contain functionality that may be removed before
22
+ the next release so all APIs should be considered unstable and you should lock
5
23
  to the exact version if used!
6
24
 
7
25
  Bug fixes:
data/Rakefile CHANGED
@@ -4,5 +4,6 @@ require "rake/testtask"
4
4
  task :default => :test
5
5
 
6
6
  Rake::TestTask.new do |t|
7
+ t.libs << "spec"
7
8
  t.pattern = File.join("spec", "**", "*_spec.rb")
8
9
  end
@@ -21,8 +21,11 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "fog-core", "~> 1.22"
23
23
  spec.add_dependency "fog-json"
24
+ spec.add_dependency "inflecto"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.3"
26
27
  spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "pry"
27
29
  spec.add_development_dependency "minitest"
30
+ spec.add_development_dependency "webmock"
28
31
  end
@@ -0,0 +1,10 @@
1
+ require "fog/core/model"
2
+ require "fog/brightbox/model_helper"
3
+
4
+ module Fog
5
+ module Brightbox
6
+ class Model < Fog::Model
7
+ include ModelHelper
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require "inflecto"
2
+
3
+ module Fog
4
+ module Brightbox
5
+ module ModelHelper
6
+ def resource_name
7
+ Inflecto.underscore(Inflecto.demodulize(self.class))
8
+ end
9
+
10
+ def collection_name
11
+ Inflecto.pluralize(resource_name)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class Account < Fog::Model
6
+ class Account < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :url
@@ -61,9 +60,7 @@ module Fog
61
60
  merge_attributes(data)
62
61
  library_ftp_password
63
62
  end
64
-
65
63
  end
66
-
67
64
  end
68
65
  end
69
66
  end
@@ -1,7 +1,9 @@
1
+ require "fog/brightbox/model"
2
+
1
3
  module Fog
2
4
  module Compute
3
5
  class Brightbox
4
- class ApiClient < Fog::Model
6
+ class ApiClient < Fog::Brightbox::Model
5
7
  identity :id
6
8
  attribute :name
7
9
  attribute :description
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class Application < Fog::Model
6
+ class Application < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :url
9
9
  attribute :name
@@ -1,10 +1,10 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
6
 
7
- class CloudIp < Fog::Model
7
+ class CloudIp < Fog::Brightbox::Model
8
8
 
9
9
  identity :id
10
10
  attribute :url
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class Collaboration < Fog::Model
6
+ class Collaboration < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :status
9
9
  attribute :email
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class DatabaseServer < Fog::Model
6
+ class DatabaseServer < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :url
9
9
  attribute :resource_type
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class DatabaseSnapshot < Fog::Model
6
+ class DatabaseSnapshot < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :url
9
9
  attribute :resource_type
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class DatabaseType < Fog::Model
6
+ class DatabaseType < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :url
9
9
  attribute :resource_type
@@ -1,10 +1,10 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class Event < Fog::Model
6
+ # @api private
7
+ class Event < Fog::Brightbox::Model
8
8
 
9
9
  identity :id
10
10
  attribute :url
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class FirewallPolicy < Fog::Model
6
+ class FirewallPolicy < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :url
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class FirewallRule < Fog::Model
6
+ class FirewallRule < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :url
@@ -46,9 +45,7 @@ module Fog
46
45
  service.destroy_firewall_rule(identity)
47
46
  true
48
47
  end
49
-
50
48
  end
51
-
52
49
  end
53
50
  end
54
51
  end
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class Flavor < Fog::Model
6
+ class Flavor < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :url
@@ -24,9 +23,7 @@ module Fog
24
23
  def bits
25
24
  0 # This is actually based on the Image type used. 32bit or 64bit Images are supported
26
25
  end
27
-
28
26
  end
29
-
30
27
  end
31
28
  end
32
29
  end
@@ -1,11 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class Image < Fog::Model
8
-
6
+ class Image < Fog::Brightbox::Model
9
7
  identity :id
10
8
  attribute :url
11
9
  attribute :resource_type
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class LoadBalancer < Fog::Model
6
+ class LoadBalancer < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :url
@@ -1,10 +1,11 @@
1
- require 'fog/compute/models/server'
1
+ require "fog/compute/models/server"
2
+ require "fog/brightbox/model_helper"
2
3
 
3
4
  module Fog
4
5
  module Compute
5
6
  class Brightbox
6
-
7
7
  class Server < Fog::Compute::Server
8
+ include Fog::Brightbox::ModelHelper
8
9
 
9
10
  identity :id
10
11
  attribute :resource_type
@@ -1,4 +1,4 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
@@ -6,8 +6,7 @@ module Fog
6
6
  # A server group is a collection of servers
7
7
  #
8
8
  # Certain actions can accept a server group and affect all members
9
- class ServerGroup < Fog::Model
10
-
9
+ class ServerGroup < Fog::Brightbox::Model
11
10
  identity :id
12
11
 
13
12
  attribute :url
@@ -1,10 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class User < Fog::Model
6
+ class User < Fog::Brightbox::Model
8
7
 
9
8
  identity :id
10
9
  attribute :resource_type
@@ -35,9 +34,7 @@ module Fog
35
34
  merge_attributes(data)
36
35
  true
37
36
  end
38
-
39
37
  end
40
-
41
38
  end
42
39
  end
43
40
  end
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
- class UserCollaboration < Fog::Model
6
+ class UserCollaboration < Fog::Brightbox::Model
7
7
  identity :id
8
8
  attribute :status
9
9
  attribute :email
@@ -1,11 +1,9 @@
1
- require 'fog/core/model'
1
+ require "fog/brightbox/model"
2
2
 
3
3
  module Fog
4
4
  module Compute
5
5
  class Brightbox
6
-
7
- class Zone < Fog::Model
8
-
6
+ class Zone < Fog::Brightbox::Model
9
7
  identity :id
10
8
  attribute :url
11
9
  attribute :resource_type
@@ -14,9 +12,7 @@ module Fog
14
12
  attribute :handle
15
13
 
16
14
  attribute :description
17
-
18
15
  end
19
-
20
16
  end
21
17
  end
22
18
  end
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Accepts the collaboration and gaining permitted access
5
+ # Accepts the collaboration giving access to the account
6
6
  #
7
7
  # @param [String] identifier Unique reference to identify the resource
8
8
  #
@@ -2,7 +2,9 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Creates a new collaboration for a user for the account
5
+ # Invites the given email address to collaborate with the specified account. Existing users
6
+ # will be able to accept the collaboration whilst those without a Brightbox account will be
7
+ # invited to create one.
6
8
  #
7
9
  # @param [Hash] options
8
10
  # @option options [String] :email Email address of user to invite
@@ -5,6 +5,7 @@ module Fog
5
5
  # @param [Hash] options
6
6
  # @option options [String] :name
7
7
  # @option options [String] :description
8
+ # @option options [String] :engine Database engine to request
8
9
  # @option options [String] :version Database version to request
9
10
  # @option options [Array] :allow_access ...
10
11
  # @option options [String] :snapshot
@@ -8,6 +8,8 @@ module Fog
8
8
  # @option options [String] :name Editable label
9
9
  # @option options [Array] :nodes Array of Node parameters
10
10
  # @option options [String] :policy Method of Load balancing to use
11
+ # @option options [String] :certificate_pem A X509 SSL certificate in PEM format. Must be included along with 'certificate_key'. If intermediate certificates are required they should be concatenated after the main certificate
12
+ # @option options [String] :certificate_key The RSA private key used to sign the certificate in PEM format. Must be included along with 'certificate_pem'
11
13
  # @option options [Array] :listeners What port to listen on, port to pass through to and protocol (tcp, http or http+ws) of listener. Timeout is optional and specified in milliseconds (default is 50000).
12
14
  # @option options [String] :healthcheck Healthcheck options - only "port" and "type" required
13
15
  #
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Shows details of one collaboration
5
+ # Shows details of the collaboration
6
6
  #
7
7
  # @param [String] identifier Unique reference to identify the resource
8
8
  #
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Shows details of one collaboration
5
+ # Shows details of the specified collaboration
6
6
  #
7
7
  # @param [String] identifier Unique reference to identify the resource
8
8
  #
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Lists all the account collaborations
5
+ # Lists all the collaborations for the given account
6
6
  #
7
7
  #
8
8
  # @return [Hash] if successful Hash version of JSON object
@@ -4,13 +4,20 @@ module Fog
4
4
  class Real
5
5
  # Lists events related to the account.
6
6
  #
7
+ # @api private
8
+ #
9
+ # @param [Hash] options
10
+ # @option options [String] :limit Limit of pagination
11
+ # @option options [String] :offset Offset of pagination
12
+ # @option options [String] :resource_id Filter events for given resource_id
7
13
  #
8
14
  # @return [Hash] if successful Hash version of JSON object
15
+ # @return [NilClass] if no options were passed
9
16
  #
10
17
  # @see https://api.gb1.brightbox.com/1.0/#event_list_events
11
18
  #
12
- def list_events
13
- wrapped_request("get", "/1.0/events", [200])
19
+ def list_events(options)
20
+ wrapped_request("get", "/1.0/events", [200], options)
14
21
  end
15
22
 
16
23
  end
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class Brightbox
4
4
  class Real
5
- # Rejects the collaboration and removes the offer
5
+ # Rejects the collaboration
6
6
  #
7
7
  # @param [String] identifier Unique reference to identify the resource
8
8
  #
@@ -9,6 +9,8 @@ module Fog
9
9
  # @option options [String] :name Editable label
10
10
  # @option options [Array] :nodes Array of Node parameters
11
11
  # @option options [String] :policy Method of Load balancing to use
12
+ # @option options [String] :certificate_pem A X509 SSL certificate in PEM format. Must be included along with 'certificate_key'. If intermediate certificates are required they should be concatenated after the main certificate
13
+ # @option options [String] :certificate_key The RSA private key used to sign the certificate in PEM format. Must be included along with 'certificate_pem'
12
14
  # @option options [Array] :listeners What port to listen on, port to pass through to and protocol (tcp, http or http+ws) of listener. Timeout is optional and specified in milliseconds (default is 50000).
13
15
  # @option options [String] :healthcheck Healthcheck options - only "port" and "type" required
14
16
  #
@@ -9,7 +9,6 @@ module Fog
9
9
  # @option options [String] :name Editable label
10
10
  # @option options [String] :user_data User defined metadata
11
11
  # @option options [Boolean] :compatibility_mode Server needs to be shutdown and restarted for changes to this to take effect
12
- # @option options [Array] :server_groups Array of Server Groups that this server should be part of
13
12
  #
14
13
  # @return [Hash] if successful Hash version of JSON object
15
14
  # @return [NilClass] if no options were passed
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "0.1.0.dev2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -1,5 +1,4 @@
1
- require "minitest/autorun"
2
- require "fog/brightbox"
1
+ require "spec_helper"
3
2
 
4
3
  describe Fog::Brightbox::Compute::Config do
5
4
  describe "when required arguments are included" do
@@ -1,5 +1,4 @@
1
- require "minitest/autorun"
2
- require "fog/brightbox"
1
+ require "spec_helper"
3
2
 
4
3
  describe Fog::Brightbox::Config do
5
4
  it "can be used to config services" do
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/account"
3
+
4
+ describe Fog::Compute::Brightbox::Account do
5
+ include ModelSetup
6
+
7
+ subject { service.accounts.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'accounts'" do
11
+ assert_equal "accounts", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'account'" do
17
+ assert_equal "account", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/api_client"
3
+
4
+ describe Fog::Compute::Brightbox::ApiClient do
5
+ include ModelSetup
6
+
7
+ subject { service.api_clients.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'api_clients'" do
11
+ assert_equal "api_clients", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'api_client'" do
17
+ assert_equal "api_client", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/application"
3
+
4
+ describe Fog::Compute::Brightbox::Application do
5
+ include ModelSetup
6
+
7
+ subject { service.applications.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'applications'" do
11
+ assert_equal "applications", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'application'" do
17
+ assert_equal "application", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/cloud_ip"
3
+
4
+ describe Fog::Compute::Brightbox::CloudIp do
5
+ include ModelSetup
6
+
7
+ subject { service.cloud_ips.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'cloud_ips'" do
11
+ assert_equal "cloud_ips", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'cloud_ip'" do
17
+ assert_equal "cloud_ip", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/collaboration"
3
+
4
+ describe Fog::Compute::Brightbox::Collaboration do
5
+ include ModelSetup
6
+
7
+ subject { service.collaborations.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'collaborations'" do
11
+ assert_equal "collaborations", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'collaboration'" do
17
+ assert_equal "collaboration", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/database_server"
3
+
4
+ describe Fog::Compute::Brightbox::DatabaseServer do
5
+ include ModelSetup
6
+
7
+ subject { service.database_servers.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'database_servers'" do
11
+ assert_equal "database_servers", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'database_server'" do
17
+ assert_equal "database_server", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/database_snapshot"
3
+
4
+ describe Fog::Compute::Brightbox::DatabaseSnapshot do
5
+ include ModelSetup
6
+
7
+ subject { service.database_snapshots.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'database_snapshots'" do
11
+ assert_equal "database_snapshots", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'database_snapshot'" do
17
+ assert_equal "database_snapshot", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/database_type"
3
+
4
+ describe Fog::Compute::Brightbox::DatabaseType do
5
+ include ModelSetup
6
+
7
+ subject { service.database_types.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'database_types'" do
11
+ assert_equal "database_types", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'database_type'" do
17
+ assert_equal "database_type", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/event"
3
+
4
+ describe Fog::Compute::Brightbox::Event do
5
+ include ModelSetup
6
+
7
+ subject { service.events.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'events'" do
11
+ assert_equal "events", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'event'" do
17
+ assert_equal "event", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/firewall_policy"
3
+
4
+ describe Fog::Compute::Brightbox::FirewallPolicy do
5
+ include ModelSetup
6
+
7
+ subject { service.firewall_policies.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'firewall_policies'" do
11
+ assert_equal "firewall_policies", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'firewall_policy'" do
17
+ assert_equal "firewall_policy", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/flavor"
3
+
4
+ describe Fog::Compute::Brightbox::Flavor do
5
+ include ModelSetup
6
+
7
+ subject { service.flavors.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'flavors'" do
11
+ assert_equal "flavors", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'flavor'" do
17
+ assert_equal "flavor", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/image"
3
+
4
+ describe Fog::Compute::Brightbox::Image do
5
+ include ModelSetup
6
+
7
+ subject { service.images.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'images'" do
11
+ assert_equal "images", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'image'" do
17
+ assert_equal "image", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/load_balancer"
3
+
4
+ describe Fog::Compute::Brightbox::LoadBalancer do
5
+ include ModelSetup
6
+
7
+ subject { service.load_balancers.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'load_balancers'" do
11
+ assert_equal "load_balancers", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'load_balancer'" do
17
+ assert_equal "load_balancer", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/server_group"
3
+
4
+ describe Fog::Compute::Brightbox::ServerGroup do
5
+ include ModelSetup
6
+
7
+ subject { service.server_groups.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'server_groups'" do
11
+ assert_equal "server_groups", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'server_group'" do
17
+ assert_equal "server_group", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/server"
3
+
4
+ describe Fog::Compute::Brightbox::Server do
5
+ include ModelSetup
6
+
7
+ subject { service.servers.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'servers'" do
11
+ assert_equal "servers", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'server'" do
17
+ assert_equal "server", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/user_collaboration"
3
+
4
+ describe Fog::Compute::Brightbox::UserCollaboration do
5
+ include ModelSetup
6
+
7
+ subject { service.user_collaborations.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'user_collaborations'" do
11
+ assert_equal "user_collaborations", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'user_collaboration'" do
17
+ assert_equal "user_collaboration", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/user"
3
+
4
+ describe Fog::Compute::Brightbox::User do
5
+ include ModelSetup
6
+
7
+ subject { service.users.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'users'" do
11
+ assert_equal "users", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'user'" do
17
+ assert_equal "user", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+ require "fog/brightbox/models/compute/zone"
3
+
4
+ describe Fog::Compute::Brightbox::Zone do
5
+ include ModelSetup
6
+
7
+ subject { service.zones.new }
8
+
9
+ describe "when asked for collection name" do
10
+ it "responds 'zones'" do
11
+ assert_equal "zones", subject.collection_name
12
+ end
13
+ end
14
+
15
+ describe "when asked for resource name" do
16
+ it "responds 'zone'" do
17
+ assert_equal "zone", subject.resource_name
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,4 @@
1
- require "minitest/autorun"
2
- require "fog/brightbox"
1
+ require "spec_helper"
3
2
 
4
3
  describe Fog::Compute::Brightbox do
5
4
  describe "when global config is available" do
@@ -0,0 +1,22 @@
1
+ module ModelSetup
2
+ def self.included(base)
3
+ base.class_eval do
4
+ let(:configuration) do
5
+ {
6
+ :brightbox_auth_url => "http://localhost",
7
+ :brightbox_api_url => "http://localhost",
8
+ :brightbox_client_id => "",
9
+ :brightbox_secret => "",
10
+ :brightbox_username => "",
11
+ :brightbox_password => "",
12
+ :brightbox_account => "",
13
+ :brightbox_default_image => "img-test",
14
+ :brightbox_access_token => "FAKECACHEDTOKEN"
15
+ }
16
+ end
17
+
18
+ let(:config) { Fog::Brightbox::Config.new(configuration) }
19
+ let(:service) { Fog::Compute::Brightbox.new(config) }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ require "minitest/autorun"
2
+ require "fog/brightbox"
3
+ require "model_helper"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.dev2
4
+ version: 0.1.0
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-22 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: inflecto
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: minitest
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +108,20 @@ dependencies:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  description: Module for the 'fog' gem to support Brightbox Cloud
84
126
  email:
85
127
  - tokengeek@gmail.com
@@ -103,6 +145,8 @@ files:
103
145
  - lib/fog/brightbox/compute/shared.rb
104
146
  - lib/fog/brightbox/config.rb
105
147
  - lib/fog/brightbox/core.rb
148
+ - lib/fog/brightbox/model.rb
149
+ - lib/fog/brightbox/model_helper.rb
106
150
  - lib/fog/brightbox/models/compute/account.rb
107
151
  - lib/fog/brightbox/models/compute/accounts.rb
108
152
  - lib/fog/brightbox/models/compute/api_client.rb
@@ -247,7 +291,27 @@ files:
247
291
  - lib/fog/brightbox/version.rb
248
292
  - spec/fog/brightbox/compute/config_spec.rb
249
293
  - spec/fog/brightbox/config_spec.rb
294
+ - spec/fog/compute/brightbox/account_spec.rb
295
+ - spec/fog/compute/brightbox/api_client_spec.rb
296
+ - spec/fog/compute/brightbox/application_spec.rb
297
+ - spec/fog/compute/brightbox/cloud_ip_spec.rb
298
+ - spec/fog/compute/brightbox/collaboration_spec.rb
299
+ - spec/fog/compute/brightbox/database_server_spec.rb
300
+ - spec/fog/compute/brightbox/database_snapshot_spec.rb
301
+ - spec/fog/compute/brightbox/database_type_spec.rb
302
+ - spec/fog/compute/brightbox/event_spec.rb
303
+ - spec/fog/compute/brightbox/firewall_policy_spec.rb
304
+ - spec/fog/compute/brightbox/flavor_spec.rb
305
+ - spec/fog/compute/brightbox/image_spec.rb
306
+ - spec/fog/compute/brightbox/load_balancer_spec.rb
307
+ - spec/fog/compute/brightbox/server_group_spec.rb
308
+ - spec/fog/compute/brightbox/server_spec.rb
309
+ - spec/fog/compute/brightbox/user_collaboration_spec.rb
310
+ - spec/fog/compute/brightbox/user_spec.rb
311
+ - spec/fog/compute/brightbox/zone_spec.rb
250
312
  - spec/fog/compute/brightbox_spec.rb
313
+ - spec/model_helper.rb
314
+ - spec/spec_helper.rb
251
315
  homepage: ''
252
316
  licenses:
253
317
  - MIT
@@ -263,9 +327,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
327
  version: '0'
264
328
  required_rubygems_version: !ruby/object:Gem::Requirement
265
329
  requirements:
266
- - - ">"
330
+ - - ">="
267
331
  - !ruby/object:Gem::Version
268
- version: 1.3.1
332
+ version: '0'
269
333
  requirements: []
270
334
  rubyforge_project:
271
335
  rubygems_version: 2.2.2
@@ -276,4 +340,24 @@ summary: This library can be used as a module for `fog` or as standalone provide
276
340
  test_files:
277
341
  - spec/fog/brightbox/compute/config_spec.rb
278
342
  - spec/fog/brightbox/config_spec.rb
343
+ - spec/fog/compute/brightbox/account_spec.rb
344
+ - spec/fog/compute/brightbox/api_client_spec.rb
345
+ - spec/fog/compute/brightbox/application_spec.rb
346
+ - spec/fog/compute/brightbox/cloud_ip_spec.rb
347
+ - spec/fog/compute/brightbox/collaboration_spec.rb
348
+ - spec/fog/compute/brightbox/database_server_spec.rb
349
+ - spec/fog/compute/brightbox/database_snapshot_spec.rb
350
+ - spec/fog/compute/brightbox/database_type_spec.rb
351
+ - spec/fog/compute/brightbox/event_spec.rb
352
+ - spec/fog/compute/brightbox/firewall_policy_spec.rb
353
+ - spec/fog/compute/brightbox/flavor_spec.rb
354
+ - spec/fog/compute/brightbox/image_spec.rb
355
+ - spec/fog/compute/brightbox/load_balancer_spec.rb
356
+ - spec/fog/compute/brightbox/server_group_spec.rb
357
+ - spec/fog/compute/brightbox/server_spec.rb
358
+ - spec/fog/compute/brightbox/user_collaboration_spec.rb
359
+ - spec/fog/compute/brightbox/user_spec.rb
360
+ - spec/fog/compute/brightbox/zone_spec.rb
279
361
  - spec/fog/compute/brightbox_spec.rb
362
+ - spec/model_helper.rb
363
+ - spec/spec_helper.rb