digital_ocean 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +13 -2
  4. data/README.md +29 -3
  5. data/lib/digital_ocean/api.rb +14 -8
  6. data/lib/digital_ocean/resource.rb +1 -0
  7. data/lib/digital_ocean/resource/domain.rb +51 -0
  8. data/lib/digital_ocean/version.rb +1 -1
  9. data/spec/api_spec.rb +122 -0
  10. data/spec/support/vcr.rb +1 -3
  11. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_be_successful.yml +46 -0
  12. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_return_domain_id.yml +46 -0
  13. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_be_successful.yml +46 -0
  14. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_return_record_id.yml +46 -0
  15. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_delete/should_be_successful.yml +46 -0
  16. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_delete_record/should_be_successful.yml +46 -0
  17. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_be_successful.yml +57 -0
  18. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_return_a_list_of_all_domains.yml +57 -0
  19. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_be_successful.yml +46 -0
  20. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_return_a_list_of_all_domain_records.yml +46 -0
  21. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_show/should_be_successful.yml +49 -0
  22. data/spec/vcr/cassettes/DigitalOcean_API/_domains/_show_record/should_be_successful.yml +46 -0
  23. metadata +28 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d2ab6a9ba68c6773569f3bff0dd17cec3c1d872
4
- data.tar.gz: a7c6fcec02cf8f70aaa76f31570031127779b9b3
3
+ metadata.gz: 46ba4ca9c73fd1fc0e1253633996ae2723e67420
4
+ data.tar.gz: 95e24b5156c7a11d070f3cf40c5fdf3ff3f2390d
5
5
  SHA512:
6
- metadata.gz: fc9a6ee6589643541c1875527c3b9201db7ee54a4cf022e317c4a9b6b552de4ca3660b0361f380f9371ce7ca55e31fbe65c1bc4fe78e0d3b509b755b5d35f724
7
- data.tar.gz: 9818a35abbb4a6dfa6ebad12758bd0bf135cc234039b3ffe402a2e2268f47694e25a598d93d3b6e74213e15d3f9fcb6d338130c6c3d8bcfc6ac7b5eb47ad081f
6
+ metadata.gz: bcf46b6e489e9d5114dcd203470c098416f7fbda4f5924bb508012b840db6290b6c67a8705d86920e226361900709ae553079df19485764ce5ba1a3f6fed51c6
7
+ data.tar.gz: b170d95918e61cbc00d53e2eab20706e74bd065cee3a762ff8803075d6d3c7f0f606020ab9cd350e2b99ba3914135e1b825027e8dde5ff7a8fed42744e472db7
data/.travis.yml CHANGED
@@ -9,3 +9,4 @@ script: bundle exec rake test
9
9
  matrix:
10
10
  allow_failures:
11
11
  - rvm: 1.8.7
12
+ - rvm: ruby-head
data/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
1
  ## unreleased
2
2
 
3
- * [Full Changelog](https://github.com/rmoriz/digital_ocean/compare/v1.0.1...master)
3
+ * [Full Changelog](https://github.com/rmoriz/digital_ocean/compare/v1.2.0...master)
4
4
 
5
5
 
6
- ## 1.0.1 / 2013-30-26
6
+ ## 1.2.0 / 2013-09-07
7
+
8
+ * add ability to enable raise_errors faraday middleware (thanks @petems)
9
+
10
+ * add support for DNS/Domain resource (thanks @CityHawk)
11
+
12
+ * improved SSL configuration. defaults to VERIFY_PEER
13
+
14
+ * [Full Changelog](https://github.com/rmoriz/digital_ocean/compare/v1.0.1...v1.2.0)
15
+
16
+
17
+ ## 1.0.1 / 2013-03-26
7
18
 
8
19
  * specified explicit min. version of faraday_middleware
9
20
 
data/README.md CHANGED
@@ -1,5 +1,21 @@
1
+ # Warning!
2
+
3
+ DigitalOcean is changing their API without notification of customers, including the author of this gem. In the past this has lead into several issues with users having problems or see unexpected behaviour.
4
+ As the author of this gem I don't make any money and DigitalOcean is not paying me, either. My spare time is limited and I hate to debug other company's problems or sneak into forums to find information / hidden API resources.
5
+
6
+ **If you run into any problem, please contact Digital Ocean first.**
7
+
8
+ **If you run into any problem, please contact Digital Ocean first.**
9
+
10
+ **If you run into any problem, please contact Digital Ocean first.**
11
+
12
+
13
+ Thank you.
14
+
1
15
  # DigitalOcean
2
16
  ### The best tested and most popular ruby gem to interact with the DigitalOcean API.
17
+
18
+ [![Gem Version](https://badge.fury.io/rb/digital_ocean.png)](http://badge.fury.io/rb/digital_ocean)
3
19
  [![Build Status](https://travis-ci.org/rmoriz/digital_ocean.png)](https://travis-ci.org/rmoriz/digital_ocean)
4
20
  [![Coverage Status](https://coveralls.io/repos/rmoriz/digital_ocean/badge.png?branch=master)](https://coveralls.io/r/rmoriz/digital_ocean)
5
21
  <a href="https://codeclimate.com/github/rmoriz/digital_ocean"><img src="https://codeclimate.com/github/rmoriz/digital_ocean.png"/></a>
@@ -32,7 +48,7 @@ Or install it yourself as:
32
48
 
33
49
  ## Prerequisite: Create an account and API credentials
34
50
 
35
- [![Create API credentials](http://i.imgur.com/1iYdSFF.png)](https://www.digitalocean.com/login)
51
+ [![Create API credentials](http://i.imgur.com/96q4zCx.png)](https://www.digitalocean.com/login)
36
52
 
37
53
  ## Usage
38
54
 
@@ -44,7 +60,8 @@ require 'digital_ocean'
44
60
  # 1. create a client instance
45
61
  #
46
62
  dc = DigitalOcean::API.new :client_id => 'YOUR_CLIENT_ID',
47
- :api_key => 'YOUR_API_KEY'
63
+ :api_key => 'YOUR_API_KEY',
64
+ :debug => true # turn on verbose request debug information
48
65
 
49
66
  # 2. get all regions (server locations)
50
67
  #
@@ -218,10 +235,19 @@ MIT
218
235
 
219
236
  Commercial support is available. Please contact [https://roland.io/](https://roland.io/) or [http://moriz.com/](http://moriz.com/)
220
237
 
238
+
239
+ ## Mobile Application
240
+
241
+ Ever wanted to control your DigitalOcean Droplets with your iPhone, iPad or iPod Touch?
242
+
243
+ [Get my CloudOcean App!](http://cloudoceanapp.com/)
244
+
245
+ [![CloudOcean - DigitalOcean iOS app](http://i.imgur.com/JLQua2w.png)](http://cloudoceanapp.com/)
246
+
247
+
221
248
  ## Copyright
222
249
 
223
250
  Copyright © 2013 [Roland Moriz](https://roland.io), [Moriz GmbH](https://moriz.de/)
224
251
 
225
252
  [![LinkedIn](http://www.linkedin.com/img/webpromo/btn_viewmy_160x25.png)](http://www.linkedin.com/in/rmoriz)
226
253
  [![Twitter](http://i.imgur.com/1kYFHlu.png)](https://twitter.com/rmoriz)
227
-
@@ -14,13 +14,14 @@ module DigitalOcean
14
14
  #
15
15
  # @see [Faraday]
16
16
  def initialize(params)
17
- @client_id = params[:client_id]
18
- @api_key = params[:api_key]
19
- @debug = params[:debug]
20
- @base_url = params[:base_url] || 'https://api.digitalocean.com/'
21
- @faraday_adapter = params[:faraday_adapter] || Faraday.default_adapter
22
- @faraday = params[:faraday] || default_faraday
23
-
17
+ @client_id = params[:client_id]
18
+ @api_key = params[:api_key]
19
+ @debug = params[:debug]
20
+ @ssl = params[:ssl] || { :verify => true }
21
+ @base_url = params[:base_url] || 'https://api.digitalocean.com/'
22
+ @faraday_adapter = params[:faraday_adapter] || Faraday.default_adapter
23
+ @raise_status_errors = params[:raise_status_errors] || false
24
+ @faraday = params[:faraday] || default_faraday
24
25
  raise ArgumentError, ':client_id missing' unless @client_id
25
26
  raise ArgumentError, ':api_key missing' unless @api_key
26
27
  end
@@ -60,9 +61,14 @@ module DigitalOcean
60
61
  DigitalOcean::Resource::Image.new(@faraday)
61
62
  end
62
63
 
64
+ def domains
65
+ DigitalOcean::Resource::Domain.new(@faraday)
66
+ end
67
+
63
68
  def default_faraday
64
- Faraday.new(:url => @base_url) do |faraday|
69
+ Faraday.new(:url => @base_url, :ssl => @ssl) do |faraday|
65
70
  faraday.use AuthenticationMiddleware, @client_id, @api_key
71
+ faraday.use Faraday::Response::RaiseError if @raise_status_errors
66
72
  faraday.request :url_encoded
67
73
  faraday.response :rashify
68
74
  faraday.response :json
@@ -4,6 +4,7 @@ require 'digital_ocean/resource/size'
4
4
  require 'digital_ocean/resource/region'
5
5
  require 'digital_ocean/resource/ssh_key'
6
6
  require 'digital_ocean/resource/image'
7
+ require 'digital_ocean/resource/domain'
7
8
 
8
9
  module DigitalOcean
9
10
  module Resource
@@ -0,0 +1,51 @@
1
+ module DigitalOcean
2
+ module Resource
3
+ class Domain < Base
4
+
5
+ def list(opts = {})
6
+ @connection.get '/domains' do |query|
7
+ apply_params(query, opts)
8
+ end.body
9
+ end
10
+
11
+ def create(params)
12
+ @connection.get '/domains/new' do |query|
13
+ apply_params(query, params)
14
+ end.body
15
+ end
16
+
17
+ def show(id, opts = {})
18
+ @connection.get "/domains/#{id}" do |query|
19
+ apply_params(query, opts)
20
+ end.body
21
+ end
22
+
23
+ def delete(id)
24
+ @connection.get("/domains/#{id}/destroy").body
25
+ end
26
+
27
+ def list_records(id, opts = {})
28
+ @connection.get "/domains/#{id}/records" do |query|
29
+ apply_params(query, opts)
30
+ end.body
31
+ end
32
+
33
+ def create_record(id, opts = {})
34
+ @connection.get "/domains/#{id}/records/new" do |query|
35
+ apply_params(query, opts)
36
+ end.body
37
+ end
38
+
39
+ def show_record(id, rec_id, opts = {})
40
+ @connection.get "/domains/#{id}/records/#{rec_id}" do |query|
41
+ apply_params(query, opts)
42
+ end.body
43
+ end
44
+
45
+ def delete_record(id, rec_id, opts = {})
46
+ @connection.get("/domains/#{id}/records/#{rec_id}/destroy").body
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -1,3 +1,3 @@
1
1
  module DigitalOcean
2
- VERSION = '1.0.1'
2
+ VERSION = '1.2.0'
3
3
  end
data/spec/api_spec.rb CHANGED
@@ -12,6 +12,12 @@ describe DigitalOcean::API, :vcr do
12
12
  end
13
13
  end
14
14
 
15
+ describe 'ssl settings' do
16
+ it 'should by default enforce ssl' do
17
+ subject.default_faraday.ssl.should == { :verify => true }
18
+ end
19
+ end
20
+
15
21
  describe '#droplets' do
16
22
  let(:droplet_id) { 106265 }
17
23
 
@@ -434,4 +440,120 @@ describe DigitalOcean::API, :vcr do
434
440
  end
435
441
 
436
442
  end
443
+
444
+ describe '#domains' do
445
+ describe '#list' do
446
+ let(:response) {
447
+ subject.domains.list
448
+ }
449
+
450
+ it 'should be successful' do
451
+ response.status.should eql('OK')
452
+ end
453
+
454
+ it 'should return a list of all domains' do
455
+ response.domains.should have_at_least(1).item
456
+ end
457
+ end
458
+
459
+ describe '#show' do
460
+ let(:id) { 26230 }
461
+ let(:response) {
462
+ subject.domains.show id
463
+ }
464
+
465
+ it 'should be successful' do
466
+ response.status.should eql('OK')
467
+ end
468
+ end
469
+
470
+ describe '#create' do
471
+ let(:name) { 'test.do.cityhawk.ru' }
472
+ let(:ip_address) { '192.81.213.70' }
473
+
474
+ let(:response) {
475
+ subject.domains.create :name => name,
476
+ :ip_address => ip_address
477
+ }
478
+
479
+ it 'should be successful' do
480
+ response.status.should eql('OK')
481
+ end
482
+
483
+ it 'should return domain.id' do
484
+ response.domain.id.should_not be_nil
485
+ end
486
+ end
487
+
488
+ describe '#delete' do
489
+ let(:domain_id) { 30158 }
490
+ let(:response) {
491
+ subject.domains.delete domain_id
492
+ }
493
+
494
+ it 'should be successful' do
495
+ response.status.should eql('OK')
496
+ end
497
+ end
498
+
499
+ let(:record_domain_id) { 30163 }
500
+
501
+ describe '#list_records' do
502
+ let(:response) {
503
+ subject.domains.list_records record_domain_id
504
+ }
505
+
506
+ it 'should be successful' do
507
+ response.status.should eql('OK')
508
+ end
509
+
510
+ it 'should return a list of all domain records' do
511
+ response.records.should have_at_least(1).item
512
+ end
513
+ end
514
+
515
+ describe '#show_record' do
516
+ let(:record_id) { 206982 }
517
+ let(:response) {
518
+ subject.domains.show_record record_domain_id, record_id
519
+ }
520
+
521
+ it 'should be successful' do
522
+ response.status.should eql('OK')
523
+ end
524
+ end
525
+
526
+ describe '#create_record' do
527
+ let(:record_type) { 'TXT' }
528
+ let(:name) { 'foo' }
529
+ let(:data) { 'bar' }
530
+
531
+ let(:response) {
532
+ subject.domains.create_record record_domain_id,
533
+ :record_type => record_type,
534
+ :name => name,
535
+ :data => data
536
+ }
537
+
538
+ it 'should be successful' do
539
+ response.status.should eql('OK')
540
+ end
541
+
542
+ it 'should return record.id' do
543
+ response.record.id.should_not be_nil
544
+ end
545
+ end
546
+
547
+ describe '#delete_record' do
548
+ let(:record_id) { 206997 }
549
+ let(:response) {
550
+ subject.domains.delete_record record_domain_id, record_id
551
+ }
552
+
553
+ it 'should be successful' do
554
+ response.status.should eql('OK')
555
+ end
556
+ end
557
+
558
+ end
437
559
  end
data/spec/support/vcr.rb CHANGED
@@ -11,9 +11,7 @@ VCR.configure do |c|
11
11
  c.filter_sensitive_data('api_key_YYYYYYYYYYYYYYYYYYYYY') { ENV['DIGITAL_OCEAN_API_KEY'] }
12
12
  end
13
13
 
14
- c.filter_sensitive_data('_digitalocean2_session=wtf') do |http_interaction|
15
- http_interaction.response.headers['set-cookie'].first
16
- end
14
+ # modern DigitalOcean API frontend doesn't send cookie_set header
17
15
 
18
16
  c.filter_sensitive_data('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') do |http_interaction|
19
17
  http_interaction.response.headers['etag'].first
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&name=test.do.cityhawk.ru&ip_address=192.81.213.70
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 02:35:34 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - aa4b015b861a799eec3d025d968a6dc1
37
+ x-runtime:
38
+ - '0.318375'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","domain":{"id":30001,"name":"test.do.cityhawk.ru"}}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 02:35:34 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&name=test.do.cityhawk.ru&ip_address=192.81.213.70
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 02:38:54 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - e3282be561c3be94e48504f986cc947a
37
+ x-runtime:
38
+ - '0.321049'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","domain":{"id":30004,"name":"test.do.cityhawk.ru"}}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 02:38:54 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&record_type=TXT&name=foo&data=bar
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:36:11 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - ddcf815378fd5e67c33862d45869c95f
37
+ x-runtime:
38
+ - '0.138155'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","record":{"id":206996,"domain_id":30163,"record_type":"TXT","name":"foo","data":"bar","priority":null,"port":null,"weight":null}}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:36:11 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&record_type=TXT&name=foo&data=bar
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:36:11 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - 850a8bdaba7a34eadef040f6b3fcdb78
37
+ x-runtime:
38
+ - '0.149414'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","record":{"id":206997,"domain_id":30163,"record_type":"TXT","name":"foo","data":"bar","priority":null,"port":null,"weight":null}}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:36:11 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30158/destroy?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:16:12 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - aa71b9fb8c13fbdf03d0a23b8fd0b7bb
37
+ x-runtime:
38
+ - '0.163320'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK"}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:16:12 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records/206997/destroy?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:39:29 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - 7f404e8b543d881a88b9b663bddbdc15
37
+ x-runtime:
38
+ - '0.271080'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK"}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:39:29 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sat, 08 Jun 2013 17:03:37 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ set-cookie:
36
+ - _digitalocean2_session=wtf
37
+ x-request-id:
38
+ - a1aa647c4728824dbf34cddd16850d7a
39
+ x-runtime:
40
+ - '0.224637'
41
+ x-rack-cache:
42
+ - miss
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"status":"OK","domains":[{"id":26230,"name":"chefserver.do.cityhawk.ru","ttl":10800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.chefserver.do.cityhawk.ru.
46
+ (\n\t\t\t1369610095 ; last update: 2013-05-26 23:14:55 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
47
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t10800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
48
+ A\t192.81.213.70\n","error":null,"zone_file_with_error":null},{"id":26233,"name":"hadoop001.do.cityhawk.ru","ttl":10800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.hadoop001.do.cityhawk.ru.
49
+ (\n\t\t\t1370638105 ; last update: 2013-06-07 20:48:25 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
50
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t10800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
51
+ A\t198.199.71.249\n","error":null,"zone_file_with_error":null},{"id":28755,"name":"hadoop006.do.cityhawk.ru","ttl":1800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.hadoop006.do.cityhawk.ru.
52
+ (\n\t\t\t1370376343 ; last update: 2013-06-04 20:05:43 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
53
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t1800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
54
+ A\t198.211.100.176\n","error":null,"zone_file_with_error":null}]}'
55
+ http_version:
56
+ recorded_at: Sat, 08 Jun 2013 17:03:38 GMT
57
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sat, 08 Jun 2013 17:03:38 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ set-cookie:
36
+ - _digitalocean2_session=wtf
37
+ x-request-id:
38
+ - ea432f6489356530d389d223248bc78f
39
+ x-runtime:
40
+ - '0.219462'
41
+ x-rack-cache:
42
+ - miss
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"status":"OK","domains":[{"id":26230,"name":"chefserver.do.cityhawk.ru","ttl":10800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.chefserver.do.cityhawk.ru.
46
+ (\n\t\t\t1369610095 ; last update: 2013-05-26 23:14:55 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
47
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t10800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
48
+ A\t192.81.213.70\n","error":null,"zone_file_with_error":null},{"id":26233,"name":"hadoop001.do.cityhawk.ru","ttl":10800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.hadoop001.do.cityhawk.ru.
49
+ (\n\t\t\t1370638105 ; last update: 2013-06-07 20:48:25 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
50
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t10800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
51
+ A\t198.199.71.249\n","error":null,"zone_file_with_error":null},{"id":28755,"name":"hadoop006.do.cityhawk.ru","ttl":1800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.hadoop006.do.cityhawk.ru.
52
+ (\n\t\t\t1370376343 ; last update: 2013-06-04 20:05:43 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
53
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t1800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
54
+ A\t198.211.100.176\n","error":null,"zone_file_with_error":null}]}'
55
+ http_version:
56
+ recorded_at: Sat, 08 Jun 2013 17:03:38 GMT
57
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:23:34 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - 814282379fdc728bb05afdb3769b0fef
37
+ x-runtime:
38
+ - '0.252342'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","records":[{"id":206982,"domain_id":30163,"record_type":"A","name":"@","data":"192.81.213.70","priority":null,"port":null,"weight":null},{"id":206983,"domain_id":30163,"record_type":"NS","name":null,"data":"NS1.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null},{"id":206984,"domain_id":30163,"record_type":"NS","name":null,"data":"NS2.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null},{"id":206985,"domain_id":30163,"record_type":"NS","name":null,"data":"NS3.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null}]}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:23:34 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:26:20 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - c0f38e0bac600bc2865e50e5471b9baf
37
+ x-runtime:
38
+ - '0.137823'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","records":[{"id":206982,"domain_id":30163,"record_type":"A","name":"@","data":"192.81.213.70","priority":null,"port":null,"weight":null},{"id":206983,"domain_id":30163,"record_type":"NS","name":null,"data":"NS1.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null},{"id":206984,"domain_id":30163,"record_type":"NS","name":null,"data":"NS2.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null},{"id":206985,"domain_id":30163,"record_type":"NS","name":null,"data":"NS3.DIGITALOCEAN.COM.","priority":null,"port":null,"weight":null}]}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:26:20 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/26230?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sat, 08 Jun 2013 17:17:59 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - d1dfeb15e1fd8c5731218cbfcf9d9f89
37
+ x-runtime:
38
+ - '0.119440'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","domain":{"id":26230,"name":"chefserver.do.cityhawk.ru","ttl":10800,"live_zone_file":"$TTL\t600\n@\t\tIN\tSOA\tNS1.DIGITALOCEAN.COM.\thostmaster.chefserver.do.cityhawk.ru.
44
+ (\n\t\t\t1369610095 ; last update: 2013-05-26 23:14:55 UTC\n\t\t\t3600 ; refresh\n\t\t\t900
45
+ ; retry\n\t\t\t1209600 ; expire\n\t\t\t10800 ; ttl\n\t\t\t)\n IN NS NS1.DIGITALOCEAN.COM.\n NS NS2.DIGITALOCEAN.COM.\n NS NS3.DIGITALOCEAN.COM.\n@\tIN
46
+ A\t192.81.213.70\n","error":null,"zone_file_with_error":null}}'
47
+ http_version:
48
+ recorded_at: Sat, 08 Jun 2013 17:17:59 GMT
49
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/domains/30163/records/206982?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - nginx
19
+ date:
20
+ - Sun, 09 Jun 2013 15:30:49 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ x-request-id:
36
+ - c4b08ee185ca817df3f635fe74de08f1
37
+ x-runtime:
38
+ - '0.135435'
39
+ x-rack-cache:
40
+ - miss
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"status":"OK","record":{"id":206982,"domain_id":30163,"record_type":"A","name":"@","data":"192.81.213.70","priority":null,"port":null,"weight":null}}'
44
+ http_version:
45
+ recorded_at: Sun, 09 Jun 2013 15:30:49 GMT
46
+ recorded_with: VCR 2.5.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digital_ocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roland Moriz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-26 00:00:00.000000000 Z
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -238,6 +238,7 @@ files:
238
238
  - lib/digital_ocean/authentication_middleware.rb
239
239
  - lib/digital_ocean/resource.rb
240
240
  - lib/digital_ocean/resource/base.rb
241
+ - lib/digital_ocean/resource/domain.rb
241
242
  - lib/digital_ocean/resource/droplet.rb
242
243
  - lib/digital_ocean/resource/image.rb
243
244
  - lib/digital_ocean/resource/region.rb
@@ -248,6 +249,18 @@ files:
248
249
  - spec/digital_ocean_spec.rb
249
250
  - spec/spec_helper.rb
250
251
  - spec/support/vcr.rb
252
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_be_successful.yml
253
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_return_domain_id.yml
254
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_be_successful.yml
255
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_return_record_id.yml
256
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_delete/should_be_successful.yml
257
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_delete_record/should_be_successful.yml
258
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_be_successful.yml
259
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_return_a_list_of_all_domains.yml
260
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_be_successful.yml
261
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_return_a_list_of_all_domain_records.yml
262
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_show/should_be_successful.yml
263
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_show_record/should_be_successful.yml
251
264
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_be_successful.yml
252
265
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_return_droplet_id.yml
253
266
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_delete/should_be_successful.yml
@@ -312,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
325
  version: '0'
313
326
  requirements: []
314
327
  rubyforge_project:
315
- rubygems_version: 2.0.0
328
+ rubygems_version: 2.0.2
316
329
  signing_key:
317
330
  specification_version: 4
318
331
  summary: This gem wraps the DigitalOcean API documented at https://api.digitalocean.com/
@@ -321,6 +334,18 @@ test_files:
321
334
  - spec/digital_ocean_spec.rb
322
335
  - spec/spec_helper.rb
323
336
  - spec/support/vcr.rb
337
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_be_successful.yml
338
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create/should_return_domain_id.yml
339
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_be_successful.yml
340
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_create_record/should_return_record_id.yml
341
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_delete/should_be_successful.yml
342
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_delete_record/should_be_successful.yml
343
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_be_successful.yml
344
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list/should_return_a_list_of_all_domains.yml
345
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_be_successful.yml
346
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_list_records/should_return_a_list_of_all_domain_records.yml
347
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_show/should_be_successful.yml
348
+ - spec/vcr/cassettes/DigitalOcean_API/_domains/_show_record/should_be_successful.yml
324
349
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_be_successful.yml
325
350
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_return_droplet_id.yml
326
351
  - spec/vcr/cassettes/DigitalOcean_API/_droplets/_delete/should_be_successful.yml