droplet_kit 1.2.3 → 1.3.0

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/droplet_kit.gemspec +2 -2
  4. data/lib/droplet_kit.rb +20 -3
  5. data/lib/droplet_kit/client.rb +2 -0
  6. data/lib/droplet_kit/error_handling_resourcable.rb +19 -0
  7. data/lib/droplet_kit/mappings/domain_record_mapping.rb +6 -6
  8. data/lib/droplet_kit/mappings/floating_ip_mapping.rb +19 -0
  9. data/lib/droplet_kit/models/floating_ip.rb +10 -0
  10. data/lib/droplet_kit/paginated_resource.rb +1 -1
  11. data/lib/droplet_kit/resources/account_resource.rb +2 -0
  12. data/lib/droplet_kit/resources/action_resource.rb +2 -0
  13. data/lib/droplet_kit/resources/domain_record_resource.rb +2 -0
  14. data/lib/droplet_kit/resources/domain_resource.rb +2 -0
  15. data/lib/droplet_kit/resources/droplet_action_resource.rb +4 -0
  16. data/lib/droplet_kit/resources/droplet_resource.rb +3 -1
  17. data/lib/droplet_kit/resources/droplet_upgrade_resource.rb +2 -0
  18. data/lib/droplet_kit/resources/floating_ip_action_resource.rb +30 -0
  19. data/lib/droplet_kit/resources/floating_ip_resource.rb +29 -0
  20. data/lib/droplet_kit/resources/image_action_resource.rb +4 -0
  21. data/lib/droplet_kit/resources/image_resource.rb +2 -0
  22. data/lib/droplet_kit/resources/region_resource.rb +2 -0
  23. data/lib/droplet_kit/resources/size_resource.rb +2 -0
  24. data/lib/droplet_kit/resources/ssh_key_resource.rb +2 -0
  25. data/lib/droplet_kit/version.rb +1 -1
  26. data/spec/fixtures/droplet_actions/change_kernel.json +27 -0
  27. data/spec/fixtures/droplet_actions/disable_backups.json +27 -0
  28. data/spec/fixtures/droplet_actions/enable_ipv6.json +27 -0
  29. data/spec/fixtures/droplet_actions/enable_private_networking.json +27 -0
  30. data/spec/fixtures/droplet_actions/find.json +19 -0
  31. data/spec/fixtures/droplet_actions/password_reset.json +27 -0
  32. data/spec/fixtures/droplet_actions/power_cycle.json +27 -0
  33. data/spec/fixtures/droplet_actions/power_off.json +27 -0
  34. data/spec/fixtures/droplet_actions/power_on.json +27 -0
  35. data/spec/fixtures/droplet_actions/reboot.json +27 -0
  36. data/spec/fixtures/droplet_actions/rebuild.json +27 -0
  37. data/spec/fixtures/droplet_actions/rename.json +27 -0
  38. data/spec/fixtures/droplet_actions/resize.json +27 -0
  39. data/spec/fixtures/droplet_actions/restore.json +27 -0
  40. data/spec/fixtures/droplet_actions/shutdown.json +27 -0
  41. data/spec/fixtures/droplet_actions/snapshot.json +27 -0
  42. data/spec/fixtures/droplet_actions/upgrade.json +27 -0
  43. data/spec/fixtures/floating_ip_actions/all.json +41 -0
  44. data/spec/fixtures/floating_ip_actions/assign.json +27 -0
  45. data/spec/fixtures/floating_ip_actions/find.json +19 -0
  46. data/spec/fixtures/floating_ip_actions/unassign.json +27 -0
  47. data/spec/fixtures/floating_ips/all.json +186 -0
  48. data/spec/fixtures/floating_ips/all_empty.json +7 -0
  49. data/spec/fixtures/floating_ips/create.json +29 -0
  50. data/spec/fixtures/floating_ips/create_with_droplet.json +44 -0
  51. data/spec/fixtures/floating_ips/find.json +28 -0
  52. data/spec/fixtures/image_actions/convert.json +27 -0
  53. data/spec/fixtures/image_actions/transfer.json +27 -0
  54. data/spec/fixtures/images/private.json +31 -0
  55. data/spec/fixtures/images/type.json +31 -0
  56. data/spec/lib/droplet_kit/resources/account_resource_spec.rb +5 -0
  57. data/spec/lib/droplet_kit/resources/action_resource_spec.rb +7 -0
  58. data/spec/lib/droplet_kit/resources/domain_record_resource_spec.rb +13 -6
  59. data/spec/lib/droplet_kit/resources/domain_resource_spec.rb +10 -3
  60. data/spec/lib/droplet_kit/resources/droplet_action_resource_spec.rb +28 -34
  61. data/spec/lib/droplet_kit/resources/droplet_resource_spec.rb +36 -17
  62. data/spec/lib/droplet_kit/resources/droplet_upgrade_resource_spec.rb +6 -0
  63. data/spec/lib/droplet_kit/resources/floating_ip_action_resource_spec.rb +137 -0
  64. data/spec/lib/droplet_kit/resources/floating_ip_resource_spec.rb +91 -0
  65. data/spec/lib/droplet_kit/resources/image_action_resource_spec.rb +31 -28
  66. data/spec/lib/droplet_kit/resources/image_resource_spec.rb +11 -4
  67. data/spec/lib/droplet_kit/resources/region_resource_spec.rb +6 -0
  68. data/spec/lib/droplet_kit/resources/size_resource_spec.rb +6 -0
  69. data/spec/lib/droplet_kit/resources/ssh_key_resource_spec.rb +7 -0
  70. data/spec/support/request_stub_helpers.rb +1 -1
  71. data/spec/support/shared_examples/common_errors.rb +27 -0
  72. data/spec/support/shared_examples/paginated_endpoint.rb +2 -1
  73. data/spec/support/shared_examples/unsuccessful_create.rb +8 -0
  74. metadata +109 -38
  75. data/spec/support/null_hash_load.rb +0 -5
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe DropletKit::FloatingIpResource do
4
+ subject(:resource) { described_class.new(connection: connection) }
5
+ include_context 'resources'
6
+
7
+ RSpec::Matchers.define :match_floating_ip_fixture do |droplet|
8
+ match do |floating_ip|
9
+ expect(floating_ip.region).to be_kind_of(DropletKit::Region)
10
+ expect(floating_ip.droplet).to be_kind_of(DropletKit::Droplet) if droplet
11
+
12
+ floating_ip.ip == "45.55.96.32"
13
+ end
14
+ end
15
+
16
+ describe '#all' do
17
+ it 'returns all of the floating_ips' do
18
+ stub_do_api('/v2/floating_ips', :get).to_return(body: api_fixture('floating_ips/all'))
19
+ floating_ips = resource.all
20
+ expect(floating_ips).to all(be_kind_of(DropletKit::FloatingIp))
21
+
22
+ expect(floating_ips.first).to match_floating_ip_fixture
23
+ end
24
+
25
+ it 'returns an empty array of floating_ips' do
26
+ stub_do_api('/v2/floating_ips', :get).to_return(body: api_fixture('floating_ips/all_empty'))
27
+ floating_ips = resource.all.map(&:ip)
28
+ expect(floating_ips).to be_empty
29
+ end
30
+
31
+ it_behaves_like 'a paginated index' do
32
+ let(:fixture_path) { 'floating_ips/all' }
33
+ let(:api_path) { '/v2/floating_ips' }
34
+ end
35
+ end
36
+
37
+ describe '#find' do
38
+ it 'returns a singular floating_ip' do
39
+ stub_do_api('/v2/floating_ips/45.55.96.32', :get).to_return(body: api_fixture('floating_ips/find'))
40
+ floating_ip = resource.find(ip: "45.55.96.32")
41
+ expect(floating_ip).to be_kind_of(DropletKit::FloatingIp)
42
+ expect(floating_ip).to match_floating_ip_fixture
43
+ end
44
+ end
45
+
46
+ describe '#create' do
47
+ let(:path) { '/v2/floating_ips' }
48
+
49
+ context 'for a successful create' do
50
+ it 'returns the created floating_ip' do
51
+ floating_ip = DropletKit::FloatingIp.new(
52
+ region: 'nyc1'
53
+ )
54
+
55
+ as_string = DropletKit::FloatingIpMapping.representation_for(:create, floating_ip)
56
+ stub_do_api(path, :post).with(body: as_string).to_return(body: api_fixture('floating_ips/create'), status: 202)
57
+ created_floating_ip = resource.create(floating_ip)
58
+
59
+ expect(created_floating_ip).to match_floating_ip_fixture
60
+ end
61
+ end
62
+
63
+ context 'for a successful create with droplet' do
64
+ it 'returns the created floating_ip' do
65
+ floating_ip = DropletKit::FloatingIp.new(
66
+ droplet_id: 123
67
+ )
68
+
69
+ as_string = DropletKit::FloatingIpMapping.representation_for(:create, floating_ip)
70
+ stub_do_api(path, :post).with(body: as_string).to_return(body: api_fixture('floating_ips/create_with_droplet'), status: 202)
71
+ created_floating_ip = resource.create(floating_ip)
72
+
73
+ expect(created_floating_ip).to match_floating_ip_fixture
74
+ end
75
+ end
76
+
77
+ it_behaves_like 'an action that handles invalid parameters' do
78
+ let(:action) { 'create' }
79
+ let(:arguments) { DropletKit::FloatingIp.new }
80
+ end
81
+ end
82
+
83
+ describe '#delete' do
84
+ it 'sends a delete request for the floating_ip' do
85
+ request = stub_do_api('/v2/floating_ips/45.55.96.32', :delete)
86
+ resource.delete(ip: "45.55.96.32")
87
+
88
+ expect(request).to have_been_made
89
+ end
90
+ end
91
+ end
@@ -4,37 +4,19 @@ RSpec.describe DropletKit::ImageActionResource do
4
4
  subject(:resource) { described_class.new(connection: connection) }
5
5
  include_context 'resources'
6
6
 
7
- def json
8
- {
9
- "action" => {
10
- "id" => 23,
11
- "status" => "in-progress",
12
- "type" => action,
13
- "started_at" => "2014-08-05T15:15:28Z",
14
- "completed_at" => nil,
15
- "resource_id" => 449676391,
16
- "resource_type" => "image",
17
- "region_slug" => "nyc1",
18
- "region" => {
19
- "name" => "New York",
20
- "slug" => "nyc1",
21
- "available" => true,
22
- "sizes" => ["512mb"],
23
- "features" => ["virtio", "private_networking", "backups", "ipv6", "metadata"]
24
- }
25
- }
26
- }.to_json
27
- end
28
-
29
7
  describe '#transfer' do
8
+ let(:image_id) { 449676391 }
9
+ let(:path) { "/v2/images/#{image_id}/actions" }
30
10
  let(:action) { 'transfer' }
31
11
 
32
12
  it 'sends a transfer request for an image' do
33
- request = stub_do_api('/v2/images/449676391/actions').with(
13
+ fixture = api_fixture('image_actions/transfer')
14
+
15
+ request = stub_do_api(path).with(
34
16
  body: { type: action, region: 'sfo1' }.to_json
35
- ).to_return(body: json, status: 201)
17
+ ).to_return(body: fixture, status: 201)
36
18
 
37
- action = resource.transfer(image_id: 449676391, region: 'sfo1')
19
+ action = resource.transfer(image_id: image_id, region: 'sfo1')
38
20
 
39
21
  expect(request).to have_been_made
40
22
 
@@ -55,17 +37,26 @@ RSpec.describe DropletKit::ImageActionResource do
55
37
  expect(action.region.available).to be(true)
56
38
  expect(action.region.features).to include("virtio", "private_networking", "backups", "ipv6", "metadata")
57
39
  end
40
+
41
+ it_behaves_like 'an action that handles invalid parameters' do
42
+ let(:object) { DropletKit::Image.new }
43
+ let(:arguments) { { image_id: image_id, region: 'sfo1' } }
44
+ end
58
45
  end
59
46
 
60
47
  describe '#convert' do
48
+ let(:image_id) { 449676391 }
49
+ let(:path) { "/v2/images/#{image_id}/actions" }
61
50
  let(:action) { 'convert' }
62
51
 
63
52
  it 'sends a convert request for an image' do
64
- request = stub_do_api('/v2/images/449676391/actions').with(
53
+ fixture = api_fixture('image_actions/convert')
54
+
55
+ request = stub_do_api(path).with(
65
56
  body: { type: action }.to_json
66
- ).to_return(body: json, status: 201)
57
+ ).to_return(body: fixture, status: 201)
67
58
 
68
- action = resource.convert(image_id: 449676391)
59
+ action = resource.convert(image_id: image_id)
69
60
 
70
61
  expect(request).to have_been_made
71
62
 
@@ -86,6 +77,11 @@ RSpec.describe DropletKit::ImageActionResource do
86
77
  expect(action.region.available).to be(true)
87
78
  expect(action.region.features).to include("virtio", "private_networking", "backups", "ipv6", "metadata")
88
79
  end
80
+
81
+ it_behaves_like 'an action that handles invalid parameters' do
82
+ let(:object) { DropletKit::Image.new }
83
+ let(:arguments) { { image_id: image_id } }
84
+ end
89
85
  end
90
86
 
91
87
  describe '#all' do
@@ -142,5 +138,12 @@ RSpec.describe DropletKit::ImageActionResource do
142
138
  expect(action.region.available).to be(true)
143
139
  expect(action.region.features).to include("virtio", "private_networking", "backups", "ipv6", "metadata")
144
140
  end
141
+
142
+ it_behaves_like 'resource that handles common errors' do
143
+ let(:path) { '/v2/images/1066/actions/123' }
144
+ let(:method) { :get }
145
+ let(:action) { :find }
146
+ let(:arguments) { { image_id: 1066, id: 123 } }
147
+ end
145
148
  end
146
149
  end
@@ -14,7 +14,7 @@ RSpec.describe DropletKit::ImageResource do
14
14
  end
15
15
 
16
16
  it 'returns private images' do
17
- images_json = api_fixture('images/all')
17
+ images_json = api_fixture('images/private')
18
18
  stub_do_api('/v2/images', :get)
19
19
  .with(query: hash_including({ private: 'true' }))
20
20
  .to_return(body: images_json)
@@ -24,7 +24,7 @@ RSpec.describe DropletKit::ImageResource do
24
24
  end
25
25
 
26
26
  it 'returns images of a type' do
27
- images_json = api_fixture('images/all')
27
+ images_json = api_fixture('images/type')
28
28
  stub_do_api('/v2/images', :get)
29
29
  .with(query: hash_including({ type: 'application' }))
30
30
  .to_return(body: images_json)
@@ -52,6 +52,13 @@ RSpec.describe DropletKit::ImageResource do
52
52
  expect(image.regions).to eq(["region--1"])
53
53
  expect(image.type).to eq("snapshot")
54
54
  end
55
+
56
+ it_behaves_like 'resource that handles common errors' do
57
+ let(:path) { '/v2/images/123' }
58
+ let(:method) { :get }
59
+ let(:action) { :find }
60
+ let(:arguments) { { id: 123 } }
61
+ end
55
62
  end
56
63
 
57
64
  describe '#delete' do
@@ -65,8 +72,8 @@ RSpec.describe DropletKit::ImageResource do
65
72
  describe '#update' do
66
73
  it 'updates an image' do
67
74
  image = DropletKit::Image.new(name: 'new-name')
68
- as_hash = DropletKit::ImageMapping.representation_for(:update, image, NullHashLoad)
69
- expect(as_hash[:name]).to eq('new-name')
75
+ as_hash = DropletKit::ImageMapping.hash_for(:update, image)
76
+ expect(as_hash['name']).to eq('new-name')
70
77
 
71
78
  request = stub_do_api('/v2/images/146', :put).with(
72
79
  body: DropletKit::ImageMapping.representation_for(:update, image)
@@ -17,5 +17,11 @@ RSpec.describe DropletKit::RegionResource do
17
17
  let(:fixture_path) {'regions/all'}
18
18
  let(:api_path) {'/v2/regions'}
19
19
  end
20
+
21
+ it_behaves_like 'resource that handles common errors' do
22
+ let(:path) { '/v2/regions' }
23
+ let(:method) { :get }
24
+ let(:action) { :all }
25
+ end
20
26
  end
21
27
  end
@@ -17,5 +17,11 @@ RSpec.describe DropletKit::SizeResource do
17
17
  let(:fixture_path) {'sizes/all'}
18
18
  let(:api_path) {'/v2/sizes'}
19
19
  end
20
+
21
+ it_behaves_like 'resource that handles common errors' do
22
+ let(:path) { '/v2/sizes' }
23
+ let(:method) { :get }
24
+ let(:action) { :all }
25
+ end
20
26
  end
21
27
  end
@@ -53,6 +53,13 @@ RSpec.describe DropletKit::SSHKeyResource do
53
53
  expect(ssh_key.public_key).to eq("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDZEgsAbWmQF+f8TU3F4fCg4yjVzdKudQbbhGb+qRKP5ju4Yo0Zzneia+oFm4bfzG+ydxUlOlbzq+Tpoj+INFv5 example")
54
54
  expect(ssh_key.name).to eq("Example Key")
55
55
  end
56
+
57
+ it_behaves_like 'resource that handles common errors' do
58
+ let(:path) { '/v2/account/keys/123' }
59
+ let(:method) { :get }
60
+ let(:action) { :find }
61
+ let(:arguments) { { id: 123 } }
62
+ end
56
63
  end
57
64
 
58
65
  describe '#update' do
@@ -7,7 +7,7 @@ module RequestStubHelpers
7
7
  Pathname.new('./spec/fixtures/').join("#{fixture_name}.json").read
8
8
  end
9
9
 
10
- def stub_pager_request(total_results = 40)
10
+ def stub_pager_request(total_results = 40)
11
11
  Faraday::Adapter::Test::Stubs.new do |stub|
12
12
  stub.get('/droplets') do |env|
13
13
  request_count.count += 1
@@ -0,0 +1,27 @@
1
+ shared_examples_for 'resource that handles common errors' do
2
+ let(:arguments) { {} }
3
+
4
+ it 'handles rate limit' do
5
+ response_body = { id: :rate_limit, message: 'Too much!!!' }
6
+ stub_do_api(path, method).to_return(body: response_body.to_json, status: 429, headers: {
7
+ 'RateLimit-Limit' => 1200,
8
+ 'RateLimit-Remaining' => 1193,
9
+ 'RateLimit-Reset' => 1402425459,
10
+ })
11
+
12
+ expect { resource.send(action, arguments).to_a }.to raise_exception(DropletKit::Error) do |exception|
13
+ expect(exception.message).to match /#{response_body[:message]}/
14
+ expect(exception.limit).to eq 1200
15
+ expect(exception.remaining).to eq 1193
16
+ expect(exception.reset_at).to eq "1402425459"
17
+ end
18
+ end
19
+
20
+ it 'handles unauthorized' do
21
+ response_body = { id: :unauthorized, message: 'Nuh uh.' }
22
+
23
+ stub_do_api(path, method).to_return(body: response_body.to_json, status: 401)
24
+
25
+ expect { resource.send(action, arguments).to_a }.to raise_exception(DropletKit::Error).with_message(/#{response_body[:message]}/)
26
+ end
27
+ end
@@ -3,11 +3,12 @@
3
3
  shared_examples_for 'a paginated index' do
4
4
  let(:fixture_path) { }
5
5
  let(:api_path) { }
6
+ let(:parameters) { {} }
6
7
 
7
8
  it 'returns a paginated resource' do
8
9
  fixture = api_fixture(fixture_path)
9
10
  stub_do_api(api_path, :get).to_return(body: fixture)
10
- response = resource.all(page: 1, per_page: 1)
11
+ response = resource.all({page: 1, per_page: 1}.merge(parameters))
11
12
  expect(response).to be_kind_of(DropletKit::PaginatedResource)
12
13
  end
13
14
  end
@@ -0,0 +1,8 @@
1
+ shared_examples_for 'an action that handles invalid parameters' do
2
+ it 'raises a FailedCreate exception with the message attached' do
3
+ response_body = { id: :unprocessable_entity, message: 'Something is not right' }
4
+ stub_do_api(path, :post).to_return(body: response_body.to_json, status: 422)
5
+
6
+ expect { resource.send(action, arguments) }.to raise_exception(DropletKit::FailedCreate).with_message(response_body[:message])
7
+ end
8
+ end
metadata CHANGED
@@ -1,173 +1,173 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droplet_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.3
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
26
  version: 1.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: resource_kit
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: 0.1.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.1
40
+ version: 0.1.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: kartograph
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.1
47
+ version: 0.2.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.1
54
+ version: 0.2.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>'
59
+ - - ">"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
- - - <
62
+ - - "<"
63
63
  - !ruby/object:Gem::Version
64
64
  version: 5.0.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>'
69
+ - - ">"
70
70
  - !ruby/object:Gem::Version
71
71
  version: '3.0'
72
- - - <
72
+ - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 5.0.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: faraday
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: 0.9.1
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.9.1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: bundler
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ~>
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '1.6'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ~>
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '1.6'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rake
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - '>='
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rspec
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ~>
121
+ - - "~>"
122
122
  - !ruby/object:Gem::Version
123
123
  version: 3.0.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ~>
128
+ - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: 3.0.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: pry
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - '>='
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: sinatra
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ~>
149
+ - - "~>"
150
150
  - !ruby/object:Gem::Version
151
151
  version: '1.4'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ~>
156
+ - - "~>"
157
157
  - !ruby/object:Gem::Version
158
158
  version: '1.4'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: webmock
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - ~>
163
+ - - "~>"
164
164
  - !ruby/object:Gem::Version
165
165
  version: '1.18'
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - ~>
170
+ - - "~>"
171
171
  - !ruby/object:Gem::Version
172
172
  version: '1.18'
173
173
  description: Droplet Kit is the official Ruby library for DigitalOcean's API
@@ -177,9 +177,9 @@ executables: []
177
177
  extensions: []
178
178
  extra_rdoc_files: []
179
179
  files:
180
- - .gitignore
181
- - .rspec
182
- - .travis.yml
180
+ - ".gitignore"
181
+ - ".rspec"
182
+ - ".travis.yml"
183
183
  - CHANGELOG.md
184
184
  - Gemfile
185
185
  - LICENSE.txt
@@ -188,6 +188,7 @@ files:
188
188
  - droplet_kit.gemspec
189
189
  - lib/droplet_kit.rb
190
190
  - lib/droplet_kit/client.rb
191
+ - lib/droplet_kit/error_handling_resourcable.rb
191
192
  - lib/droplet_kit/mappings/account_mapping.rb
192
193
  - lib/droplet_kit/mappings/action_mapping.rb
193
194
  - lib/droplet_kit/mappings/backup_mapping.rb
@@ -196,6 +197,7 @@ files:
196
197
  - lib/droplet_kit/mappings/droplet_mapping.rb
197
198
  - lib/droplet_kit/mappings/droplet_upgrade_mapping.rb
198
199
  - lib/droplet_kit/mappings/error_mapping.rb
200
+ - lib/droplet_kit/mappings/floating_ip_mapping.rb
199
201
  - lib/droplet_kit/mappings/image_action_mapping.rb
200
202
  - lib/droplet_kit/mappings/image_mapping.rb
201
203
  - lib/droplet_kit/mappings/kernel_mapping.rb
@@ -213,6 +215,7 @@ files:
213
215
  - lib/droplet_kit/models/domain_record.rb
214
216
  - lib/droplet_kit/models/droplet.rb
215
217
  - lib/droplet_kit/models/droplet_upgrade.rb
218
+ - lib/droplet_kit/models/floating_ip.rb
216
219
  - lib/droplet_kit/models/image.rb
217
220
  - lib/droplet_kit/models/image_action.rb
218
221
  - lib/droplet_kit/models/kernel.rb
@@ -232,6 +235,8 @@ files:
232
235
  - lib/droplet_kit/resources/droplet_action_resource.rb
233
236
  - lib/droplet_kit/resources/droplet_resource.rb
234
237
  - lib/droplet_kit/resources/droplet_upgrade_resource.rb
238
+ - lib/droplet_kit/resources/floating_ip_action_resource.rb
239
+ - lib/droplet_kit/resources/floating_ip_resource.rb
235
240
  - lib/droplet_kit/resources/image_action_resource.rb
236
241
  - lib/droplet_kit/resources/image_resource.rb
237
242
  - lib/droplet_kit/resources/region_resource.rb
@@ -249,6 +254,23 @@ files:
249
254
  - spec/fixtures/domains/all.json
250
255
  - spec/fixtures/domains/create.json
251
256
  - spec/fixtures/domains/find.json
257
+ - spec/fixtures/droplet_actions/change_kernel.json
258
+ - spec/fixtures/droplet_actions/disable_backups.json
259
+ - spec/fixtures/droplet_actions/enable_ipv6.json
260
+ - spec/fixtures/droplet_actions/enable_private_networking.json
261
+ - spec/fixtures/droplet_actions/find.json
262
+ - spec/fixtures/droplet_actions/password_reset.json
263
+ - spec/fixtures/droplet_actions/power_cycle.json
264
+ - spec/fixtures/droplet_actions/power_off.json
265
+ - spec/fixtures/droplet_actions/power_on.json
266
+ - spec/fixtures/droplet_actions/reboot.json
267
+ - spec/fixtures/droplet_actions/rebuild.json
268
+ - spec/fixtures/droplet_actions/rename.json
269
+ - spec/fixtures/droplet_actions/resize.json
270
+ - spec/fixtures/droplet_actions/restore.json
271
+ - spec/fixtures/droplet_actions/shutdown.json
272
+ - spec/fixtures/droplet_actions/snapshot.json
273
+ - spec/fixtures/droplet_actions/upgrade.json
252
274
  - spec/fixtures/droplet_upgrades/all.json
253
275
  - spec/fixtures/droplets/all.json
254
276
  - spec/fixtures/droplets/all_empty.json
@@ -258,10 +280,23 @@ files:
258
280
  - spec/fixtures/droplets/list_backups.json
259
281
  - spec/fixtures/droplets/list_kernels.json
260
282
  - spec/fixtures/droplets/list_snapshots.json
283
+ - spec/fixtures/floating_ip_actions/all.json
284
+ - spec/fixtures/floating_ip_actions/assign.json
285
+ - spec/fixtures/floating_ip_actions/find.json
286
+ - spec/fixtures/floating_ip_actions/unassign.json
287
+ - spec/fixtures/floating_ips/all.json
288
+ - spec/fixtures/floating_ips/all_empty.json
289
+ - spec/fixtures/floating_ips/create.json
290
+ - spec/fixtures/floating_ips/create_with_droplet.json
291
+ - spec/fixtures/floating_ips/find.json
261
292
  - spec/fixtures/image_actions/all.json
293
+ - spec/fixtures/image_actions/convert.json
262
294
  - spec/fixtures/image_actions/find.json
295
+ - spec/fixtures/image_actions/transfer.json
263
296
  - spec/fixtures/images/all.json
264
297
  - spec/fixtures/images/find.json
298
+ - spec/fixtures/images/private.json
299
+ - spec/fixtures/images/type.json
265
300
  - spec/fixtures/regions/all.json
266
301
  - spec/fixtures/sizes/all.json
267
302
  - spec/fixtures/ssh_keys/all.json
@@ -279,6 +314,8 @@ files:
279
314
  - spec/lib/droplet_kit/resources/droplet_action_resource_spec.rb
280
315
  - spec/lib/droplet_kit/resources/droplet_resource_spec.rb
281
316
  - spec/lib/droplet_kit/resources/droplet_upgrade_resource_spec.rb
317
+ - spec/lib/droplet_kit/resources/floating_ip_action_resource_spec.rb
318
+ - spec/lib/droplet_kit/resources/floating_ip_resource_spec.rb
282
319
  - spec/lib/droplet_kit/resources/image_action_resource_spec.rb
283
320
  - spec/lib/droplet_kit/resources/image_resource_spec.rb
284
321
  - spec/lib/droplet_kit/resources/region_resource_spec.rb
@@ -286,10 +323,11 @@ files:
286
323
  - spec/lib/droplet_kit/resources/ssh_key_resource_spec.rb
287
324
  - spec/spec_helper.rb
288
325
  - spec/support/fake_server.rb
289
- - spec/support/null_hash_load.rb
290
326
  - spec/support/request_stub_helpers.rb
291
327
  - spec/support/resource_context.rb
328
+ - spec/support/shared_examples/common_errors.rb
292
329
  - spec/support/shared_examples/paginated_endpoint.rb
330
+ - spec/support/shared_examples/unsuccessful_create.rb
293
331
  homepage: ''
294
332
  licenses:
295
333
  - MIT
@@ -300,17 +338,17 @@ require_paths:
300
338
  - lib
301
339
  required_ruby_version: !ruby/object:Gem::Requirement
302
340
  requirements:
303
- - - '>='
341
+ - - ">="
304
342
  - !ruby/object:Gem::Version
305
343
  version: 2.0.0
306
344
  required_rubygems_version: !ruby/object:Gem::Requirement
307
345
  requirements:
308
- - - '>='
346
+ - - ">="
309
347
  - !ruby/object:Gem::Version
310
348
  version: '0'
311
349
  requirements: []
312
350
  rubyforge_project:
313
- rubygems_version: 2.2.2
351
+ rubygems_version: 2.4.5.1
314
352
  signing_key:
315
353
  specification_version: 4
316
354
  summary: Droplet Kit is the official Ruby library for DigitalOcean's API
@@ -325,6 +363,23 @@ test_files:
325
363
  - spec/fixtures/domains/all.json
326
364
  - spec/fixtures/domains/create.json
327
365
  - spec/fixtures/domains/find.json
366
+ - spec/fixtures/droplet_actions/change_kernel.json
367
+ - spec/fixtures/droplet_actions/disable_backups.json
368
+ - spec/fixtures/droplet_actions/enable_ipv6.json
369
+ - spec/fixtures/droplet_actions/enable_private_networking.json
370
+ - spec/fixtures/droplet_actions/find.json
371
+ - spec/fixtures/droplet_actions/password_reset.json
372
+ - spec/fixtures/droplet_actions/power_cycle.json
373
+ - spec/fixtures/droplet_actions/power_off.json
374
+ - spec/fixtures/droplet_actions/power_on.json
375
+ - spec/fixtures/droplet_actions/reboot.json
376
+ - spec/fixtures/droplet_actions/rebuild.json
377
+ - spec/fixtures/droplet_actions/rename.json
378
+ - spec/fixtures/droplet_actions/resize.json
379
+ - spec/fixtures/droplet_actions/restore.json
380
+ - spec/fixtures/droplet_actions/shutdown.json
381
+ - spec/fixtures/droplet_actions/snapshot.json
382
+ - spec/fixtures/droplet_actions/upgrade.json
328
383
  - spec/fixtures/droplet_upgrades/all.json
329
384
  - spec/fixtures/droplets/all.json
330
385
  - spec/fixtures/droplets/all_empty.json
@@ -334,10 +389,23 @@ test_files:
334
389
  - spec/fixtures/droplets/list_backups.json
335
390
  - spec/fixtures/droplets/list_kernels.json
336
391
  - spec/fixtures/droplets/list_snapshots.json
392
+ - spec/fixtures/floating_ip_actions/all.json
393
+ - spec/fixtures/floating_ip_actions/assign.json
394
+ - spec/fixtures/floating_ip_actions/find.json
395
+ - spec/fixtures/floating_ip_actions/unassign.json
396
+ - spec/fixtures/floating_ips/all.json
397
+ - spec/fixtures/floating_ips/all_empty.json
398
+ - spec/fixtures/floating_ips/create.json
399
+ - spec/fixtures/floating_ips/create_with_droplet.json
400
+ - spec/fixtures/floating_ips/find.json
337
401
  - spec/fixtures/image_actions/all.json
402
+ - spec/fixtures/image_actions/convert.json
338
403
  - spec/fixtures/image_actions/find.json
404
+ - spec/fixtures/image_actions/transfer.json
339
405
  - spec/fixtures/images/all.json
340
406
  - spec/fixtures/images/find.json
407
+ - spec/fixtures/images/private.json
408
+ - spec/fixtures/images/type.json
341
409
  - spec/fixtures/regions/all.json
342
410
  - spec/fixtures/sizes/all.json
343
411
  - spec/fixtures/ssh_keys/all.json
@@ -355,6 +423,8 @@ test_files:
355
423
  - spec/lib/droplet_kit/resources/droplet_action_resource_spec.rb
356
424
  - spec/lib/droplet_kit/resources/droplet_resource_spec.rb
357
425
  - spec/lib/droplet_kit/resources/droplet_upgrade_resource_spec.rb
426
+ - spec/lib/droplet_kit/resources/floating_ip_action_resource_spec.rb
427
+ - spec/lib/droplet_kit/resources/floating_ip_resource_spec.rb
358
428
  - spec/lib/droplet_kit/resources/image_action_resource_spec.rb
359
429
  - spec/lib/droplet_kit/resources/image_resource_spec.rb
360
430
  - spec/lib/droplet_kit/resources/region_resource_spec.rb
@@ -362,7 +432,8 @@ test_files:
362
432
  - spec/lib/droplet_kit/resources/ssh_key_resource_spec.rb
363
433
  - spec/spec_helper.rb
364
434
  - spec/support/fake_server.rb
365
- - spec/support/null_hash_load.rb
366
435
  - spec/support/request_stub_helpers.rb
367
436
  - spec/support/resource_context.rb
437
+ - spec/support/shared_examples/common_errors.rb
368
438
  - spec/support/shared_examples/paginated_endpoint.rb
439
+ - spec/support/shared_examples/unsuccessful_create.rb