dorb 0.0.1.pre

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 (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +16 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +198 -0
  8. data/Rakefile +4 -0
  9. data/dorb.gemspec +30 -0
  10. data/lib/dorb.rb +18 -0
  11. data/lib/dorb/config.rb +36 -0
  12. data/lib/dorb/core_ext/hash.rb +24 -0
  13. data/lib/dorb/droplet.rb +10 -0
  14. data/lib/dorb/image.rb +10 -0
  15. data/lib/dorb/region.rb +10 -0
  16. data/lib/dorb/resource.rb +126 -0
  17. data/lib/dorb/size.rb +16 -0
  18. data/lib/dorb/ssh_key.rb +10 -0
  19. data/lib/dorb/version.rb +3 -0
  20. data/spec/config_spec.rb +34 -0
  21. data/spec/droplet_spec.rb +7 -0
  22. data/spec/fixtures/cassettes/DORB_Droplet/all.yml +57 -0
  23. data/spec/fixtures/cassettes/DORB_Droplet/find.yml +111 -0
  24. data/spec/fixtures/cassettes/DORB_Droplet/find_missing.yml +57 -0
  25. data/spec/fixtures/cassettes/DORB_Image/all.yml +75 -0
  26. data/spec/fixtures/cassettes/DORB_Image/find.yml +129 -0
  27. data/spec/fixtures/cassettes/DORB_Image/find_missing.yml +57 -0
  28. data/spec/fixtures/cassettes/DORB_Region/all.yml +58 -0
  29. data/spec/fixtures/cassettes/DORB_Region/find.yml +112 -0
  30. data/spec/fixtures/cassettes/DORB_Region/find_missing.yml +57 -0
  31. data/spec/fixtures/cassettes/DORB_SSHKey/all.yml +57 -0
  32. data/spec/fixtures/cassettes/DORB_SSHKey/find.yml +113 -0
  33. data/spec/fixtures/cassettes/DORB_SSHKey/find_missing.yml +57 -0
  34. data/spec/fixtures/cassettes/DORB_Size/all.yml +597 -0
  35. data/spec/fixtures/cassettes/DORB_Size/find.yml +651 -0
  36. data/spec/fixtures/cassettes/DORB_Size/find_missing.yml +57 -0
  37. data/spec/image_spec.rb +7 -0
  38. data/spec/region_spec.rb +7 -0
  39. data/spec/size_spec.rb +19 -0
  40. data/spec/spec_helper.rb +17 -0
  41. data/spec/ssh_key_spec.rb +7 -0
  42. data/spec/support/shared_examples_for_resource.rb +40 -0
  43. data/spec/support/vcr.rb +8 -0
  44. metadata +209 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.digitalocean.com/sizes/0?api_key=<API_KEY>&client_id=<CLIENT_ID>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*; q=0.5, application/xml'
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Wed, 13 Mar 2013 12:16:16 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - '200'
33
+ X-Powered-By:
34
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
35
+ Strict-Transport-Security:
36
+ - max-age=31536000
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Etag:
40
+ - ! '"a8692ea51a7ca8869222d295a1229ca7"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ Set-Cookie:
44
+ - _digitalocean2_session_v2=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTc5ZDlhZjU0NjYxODZmYmQ1NDk0OGEzNzdmZDc1MWU0BjsAVEkiEXJlZGlyZWN0X3VybAY7AEZJIn9odHRwczovL3d3dy5kaWdpdGFsb2NlYW4uY29tL2FwaS9zaXplcy8wP2NsaWVudF9pZD04NFU5cUh3ZTJONzNkRW9QRlZxS3omYXBpX2tleT1xUThtcFJpRVlnM3VPNk9yTFRUZUpEMUR2UEdFUWhWbU1lSHZEcjNkbQY7AEY%3D--0627d14249d81e3136b1641bb91f36211b0f433c;
45
+ path=/; secure; HttpOnly
46
+ X-Request-Id:
47
+ - 93f140a217cdf0ee3359d98eab13f546
48
+ X-Runtime:
49
+ - '0.298990'
50
+ X-Rack-Cache:
51
+ - miss
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ! '{"status":"ERROR","error_message":"No Size Found"}'
55
+ http_version:
56
+ recorded_at: Wed, 13 Mar 2013 12:16:15 GMT
57
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DORB::Image do
4
+
5
+ it_should_behave_like 'a resource'
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DORB::Region do
4
+
5
+ it_should_behave_like 'a resource'
6
+
7
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DORB::Size do
4
+
5
+ it_should_behave_like 'a resource'
6
+
7
+ subject { DORB::Size.new(:id => 1,
8
+ :name => '2GB',
9
+ :memory => 2048,
10
+ :disk => 40,
11
+ :cpu => 2,
12
+ :cost_per_hour => 0.02976) }
13
+
14
+ it { should respond_to(:memory) }
15
+ it { should respond_to(:disk) }
16
+ it { should respond_to(:cpu) }
17
+ it { should respond_to(:cost_per_hour) }
18
+
19
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|f| require f}
5
+
6
+ require 'dorb'
7
+
8
+ RSpec.configure do |config|
9
+ config.after(:each) do
10
+ DORB::Config.client_id = nil
11
+ DORB::Config.api_key = nil
12
+ end
13
+ config.treat_symbols_as_metadata_keys_with_true_values = true
14
+ config.run_all_when_everything_filtered = true
15
+ config.filter_run :focus
16
+ config.order = 'random'
17
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DORB::SSHKey do
4
+
5
+ it_should_behave_like 'a resource'
6
+
7
+ end
@@ -0,0 +1,40 @@
1
+ shared_examples_for "a resource" do
2
+
3
+ subject { described_class.new(:id => 1, :name => 'name') }
4
+
5
+ it { should respond_to(:id) }
6
+ it { should respond_to(:name) }
7
+
8
+ before(:each) do
9
+ DORB::Config.setup :client_id => ENV['DIGITAL_OCEAN_CLIENT_ID'], :api_key => ENV['DIGITAL_OCEAN_API_KEY']
10
+ end
11
+
12
+ describe '.all' do
13
+ it "should return an enumerable collection of all the available #{described_class} resources" do
14
+ VCR.use_cassette "#{described_class}/all" do
15
+ resources = described_class.all
16
+ resources.should_not be_empty
17
+ resources.should respond_to(:each)
18
+ resources.all? { |resource| resource.should be_an_instance_of(described_class) }
19
+ end
20
+ end
21
+ end
22
+
23
+ describe '.find' do
24
+ it "should return an instance representing the #{described_class} resource" do
25
+ VCR.use_cassette "#{described_class}/find" do
26
+ id = described_class.all.first.id
27
+ resource = described_class.find(id)
28
+ end
29
+ end
30
+
31
+ context "when requested resource does not exist" do
32
+ it "should raise an API Error" do
33
+ VCR.use_cassette "#{described_class}/find_missing" do
34
+ expect { resource = described_class.find(0) }.to raise_error(DORB::APIError)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,8 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'cassettes')
5
+ c.hook_into :webmock
6
+ c.filter_sensitive_data('<CLIENT_ID>') { ENV['DIGITAL_OCEAN_CLIENT_ID'] }
7
+ c.filter_sensitive_data('<API_KEY>') { ENV['DIGITAL_OCEAN_API_KEY'] }
8
+ end
metadata ADDED
@@ -0,0 +1,209 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dorb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre
5
+ platform: ruby
6
+ authors:
7
+ - Darrin Wortlehock
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
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'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Interact with the Digital Ocean API in an idiomatic ruby way.
112
+ email:
113
+ - darrin@exempla.co.uk
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - .travis.yml
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - dorb.gemspec
126
+ - lib/dorb.rb
127
+ - lib/dorb/config.rb
128
+ - lib/dorb/core_ext/hash.rb
129
+ - lib/dorb/droplet.rb
130
+ - lib/dorb/image.rb
131
+ - lib/dorb/region.rb
132
+ - lib/dorb/resource.rb
133
+ - lib/dorb/size.rb
134
+ - lib/dorb/ssh_key.rb
135
+ - lib/dorb/version.rb
136
+ - spec/config_spec.rb
137
+ - spec/droplet_spec.rb
138
+ - spec/fixtures/cassettes/DORB_Droplet/all.yml
139
+ - spec/fixtures/cassettes/DORB_Droplet/find.yml
140
+ - spec/fixtures/cassettes/DORB_Droplet/find_missing.yml
141
+ - spec/fixtures/cassettes/DORB_Image/all.yml
142
+ - spec/fixtures/cassettes/DORB_Image/find.yml
143
+ - spec/fixtures/cassettes/DORB_Image/find_missing.yml
144
+ - spec/fixtures/cassettes/DORB_Region/all.yml
145
+ - spec/fixtures/cassettes/DORB_Region/find.yml
146
+ - spec/fixtures/cassettes/DORB_Region/find_missing.yml
147
+ - spec/fixtures/cassettes/DORB_SSHKey/all.yml
148
+ - spec/fixtures/cassettes/DORB_SSHKey/find.yml
149
+ - spec/fixtures/cassettes/DORB_SSHKey/find_missing.yml
150
+ - spec/fixtures/cassettes/DORB_Size/all.yml
151
+ - spec/fixtures/cassettes/DORB_Size/find.yml
152
+ - spec/fixtures/cassettes/DORB_Size/find_missing.yml
153
+ - spec/image_spec.rb
154
+ - spec/region_spec.rb
155
+ - spec/size_spec.rb
156
+ - spec/spec_helper.rb
157
+ - spec/ssh_key_spec.rb
158
+ - spec/support/shared_examples_for_resource.rb
159
+ - spec/support/vcr.rb
160
+ homepage: https://github.com/exempla/dorb
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - '>='
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - '>'
176
+ - !ruby/object:Gem::Version
177
+ version: 1.3.1
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.0.0
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: DORB exposes the Digital Ocean API as Ruby objects, has 100% test coverage
184
+ and supports the entire API.
185
+ test_files:
186
+ - spec/config_spec.rb
187
+ - spec/droplet_spec.rb
188
+ - spec/fixtures/cassettes/DORB_Droplet/all.yml
189
+ - spec/fixtures/cassettes/DORB_Droplet/find.yml
190
+ - spec/fixtures/cassettes/DORB_Droplet/find_missing.yml
191
+ - spec/fixtures/cassettes/DORB_Image/all.yml
192
+ - spec/fixtures/cassettes/DORB_Image/find.yml
193
+ - spec/fixtures/cassettes/DORB_Image/find_missing.yml
194
+ - spec/fixtures/cassettes/DORB_Region/all.yml
195
+ - spec/fixtures/cassettes/DORB_Region/find.yml
196
+ - spec/fixtures/cassettes/DORB_Region/find_missing.yml
197
+ - spec/fixtures/cassettes/DORB_SSHKey/all.yml
198
+ - spec/fixtures/cassettes/DORB_SSHKey/find.yml
199
+ - spec/fixtures/cassettes/DORB_SSHKey/find_missing.yml
200
+ - spec/fixtures/cassettes/DORB_Size/all.yml
201
+ - spec/fixtures/cassettes/DORB_Size/find.yml
202
+ - spec/fixtures/cassettes/DORB_Size/find_missing.yml
203
+ - spec/image_spec.rb
204
+ - spec/region_spec.rb
205
+ - spec/size_spec.rb
206
+ - spec/spec_helper.rb
207
+ - spec/ssh_key_spec.rb
208
+ - spec/support/shared_examples_for_resource.rb
209
+ - spec/support/vcr.rb