digitalocean 0.0.3 → 1.0.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Digitalocean::Size do
4
- let(:ok) { "OK" }
5
4
  let(:subject) { Digitalocean::Size }
6
5
 
7
- context "correct api key" do
6
+ describe "._all" do
8
7
  before do
9
- set_client_id_and_api_key!
8
+ @url = subject._all
10
9
  end
11
10
 
12
- describe ".all" do
13
- before do
14
- @response = subject.all
15
- end
16
-
17
- context "default" do
18
- it do
19
- @response.status.should eq ok
20
- end
21
- end
11
+ it do
12
+ @url.should eq "https://api.digitalocean.com/sizes/?client_id=client_id_required&api_key=api_key_required"
22
13
  end
23
14
  end
24
- end
15
+ end
@@ -1,24 +1,40 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Digitalocean::SshKey do
4
- let(:ok) { "OK" }
5
4
  let(:subject) { Digitalocean::SshKey }
6
5
 
7
- context "correct api key" do
6
+ describe "._all" do
8
7
  before do
9
- set_client_id_and_api_key!
8
+ @url = subject._all
10
9
  end
11
10
 
12
- describe ".all" do
13
- before do
14
- @response = subject.all
15
- end
11
+ it do
12
+ @url.should eq "https://api.digitalocean.com/ssh_keys/?client_id=client_id_required&api_key=api_key_required"
13
+ end
14
+ end
15
+
16
+ describe "._find" do
17
+ let(:ssh_key_id) { "test_key" }
18
+ before do
19
+ @url = subject._find(ssh_key_id)
20
+ end
21
+
22
+ it do
23
+ @url.should eq "https://api.digitalocean.com/ssh_keys/test_key/?client_id=client_id_required&api_key=api_key_required"
24
+ end
25
+ end
26
+
27
+ describe "._create" do
28
+ let(:name) { "test_name" }
29
+ let(:ssh_pub_key) { "test_pub_key" }
30
+ let(:attrs) { { name: name, ssh_pub_key: ssh_pub_key } }
31
+
32
+ before do
33
+ @url = subject._create(attrs)
34
+ end
16
35
 
17
- context "default" do
18
- it do
19
- @response.status.should eq ok
20
- end
21
- end
36
+ it do
37
+ @url.should eq "https://api.digitalocean.com/ssh_keys/new/?name=#{name}&ssh_pub_key=#{ssh_pub_key}&client_id=client_id_required&api_key=api_key_required"
22
38
  end
23
39
  end
24
- end
40
+ end
@@ -10,8 +10,9 @@ describe Digitalocean do
10
10
  end
11
11
 
12
12
  it { subject.api_endpoint.should eq "https://api.digitalocean.com" }
13
- it { subject.client_id.should eq "missing_client_id" }
14
- it { subject.api_key.should eq "missing_api_key" }
13
+ it { subject.client_id.should eq "client_id_required" }
14
+ it { subject.api_key.should eq "api_key_required" }
15
+ it { subject::VERSION.should eq "1.0.0.rc.2" }
15
16
  end
16
17
 
17
18
  describe "setting values" do
@@ -26,4 +27,4 @@ describe Digitalocean do
26
27
  it { subject.client_id.should eq client_id }
27
28
  it { subject.api_key.should eq api_key }
28
29
  end
29
- end
30
+ end
@@ -8,16 +8,6 @@ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].e
8
8
 
9
9
  RSpec.configure do |config|
10
10
  config.before(:suite) do
11
- # FakeWeb.allow_net_connect = false
12
- set_client_id_and_api_key!
13
11
  end
14
-
15
- # config.after(:suite) do
16
- # FakeWeb.allow_net_connect = true
17
- # end
18
12
  end
19
13
 
20
- def set_client_id_and_api_key!
21
- Digitalocean.client_id = ENV['DIGITALOCEAN_CLIENT_ID']
22
- Digitalocean.api_key = ENV['DIGITALOCEAN_API_KEY']
23
- end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digitalocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0.rc.2
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - scottmotte
@@ -9,104 +10,118 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-01-09 00:00:00.000000000 Z
13
+ date: 2014-02-08 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: faraday
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - '>='
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - '>='
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: faraday_middleware
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - '>='
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - '>='
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: recursive-open-struct
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - '>='
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - '>='
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: foreman
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - '>='
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - '>='
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: pry
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
- - - '>='
84
+ - - ! '>='
75
85
  - !ruby/object:Gem::Version
76
86
  version: '0'
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
- - - '>='
92
+ - - ! '>='
82
93
  - !ruby/object:Gem::Version
83
94
  version: '0'
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: rake
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
- - - '>='
100
+ - - ! '>='
89
101
  - !ruby/object:Gem::Version
90
102
  version: '0'
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
- - - '>='
108
+ - - ! '>='
96
109
  - !ruby/object:Gem::Version
97
110
  version: '0'
98
111
  - !ruby/object:Gem::Dependency
99
112
  name: rspec
100
113
  requirement: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
- - - '>='
116
+ - - ! '>='
103
117
  - !ruby/object:Gem::Version
104
118
  version: '0'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
108
123
  requirements:
109
- - - '>='
124
+ - - ! '>='
110
125
  - !ruby/object:Gem::Version
111
126
  version: '0'
112
127
  description: Ruby bindings for the Digital Ocean API.
@@ -117,7 +132,6 @@ executables: []
117
132
  extensions: []
118
133
  extra_rdoc_files: []
119
134
  files:
120
- - .env-example
121
135
  - .gitignore
122
136
  - .rspec
123
137
  - Gemfile
@@ -126,17 +140,11 @@ files:
126
140
  - Rakefile
127
141
  - digitalocean.gemspec
128
142
  - lib/digitalocean.rb
129
- - lib/digitalocean/domain.rb
130
- - lib/digitalocean/droplet.rb
131
- - lib/digitalocean/image.rb
132
- - lib/digitalocean/record.rb
133
- - lib/digitalocean/region.rb
134
- - lib/digitalocean/size.rb
135
- - lib/digitalocean/ssh_key.rb
136
143
  - lib/digitalocean/version.rb
137
144
  - spec/digitalocean/domain_spec.rb
138
145
  - spec/digitalocean/droplet_spec.rb
139
146
  - spec/digitalocean/image_spec.rb
147
+ - spec/digitalocean/integration_spec.rb
140
148
  - spec/digitalocean/record_spec.rb
141
149
  - spec/digitalocean/region_spec.rb
142
150
  - spec/digitalocean/size_spec.rb
@@ -145,35 +153,36 @@ files:
145
153
  - spec/spec_helper.rb
146
154
  homepage: http://github.com/scottmotte/digitalocean
147
155
  licenses: []
148
- metadata: {}
149
156
  post_install_message:
150
157
  rdoc_options: []
151
158
  require_paths:
152
159
  - lib
153
160
  required_ruby_version: !ruby/object:Gem::Requirement
161
+ none: false
154
162
  requirements:
155
- - - '>='
163
+ - - ! '>='
156
164
  - !ruby/object:Gem::Version
157
165
  version: '0'
158
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
159
168
  requirements:
160
- - - '>='
169
+ - - ! '>'
161
170
  - !ruby/object:Gem::Version
162
- version: '0'
171
+ version: 1.3.1
163
172
  requirements: []
164
173
  rubyforge_project:
165
- rubygems_version: 2.0.3
174
+ rubygems_version: 1.8.23
166
175
  signing_key:
167
- specification_version: 4
176
+ specification_version: 3
168
177
  summary: Ruby bindings for the Digital Ocean API.
169
178
  test_files:
170
179
  - spec/digitalocean/domain_spec.rb
171
180
  - spec/digitalocean/droplet_spec.rb
172
181
  - spec/digitalocean/image_spec.rb
182
+ - spec/digitalocean/integration_spec.rb
173
183
  - spec/digitalocean/record_spec.rb
174
184
  - spec/digitalocean/region_spec.rb
175
185
  - spec/digitalocean/size_spec.rb
176
186
  - spec/digitalocean/ssh_key_spec.rb
177
187
  - spec/digitalocean_spec.rb
178
188
  - spec/spec_helper.rb
179
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0bcfea9e0a5aba026b03372ef1667fe125912831
4
- data.tar.gz: e9fd93b107102e8e1c66716271796f41dc76472b
5
- SHA512:
6
- metadata.gz: f298f4774324d7e70b4c4015ee023e7184cc3167d2f93e52d2c4870346e41c2d88b448387625a4aebaff30c184784941a4a47b6ea6168c8d70f73446305b128f
7
- data.tar.gz: 4c1ddb9a6b0e0e43677e7143f8df7a2efc4e5139d554734332558f0fe2180ca6a64ebcaa0809663179da8286e959918c2e863fb6a2ebb042062dd42e504733e4
@@ -1,2 +0,0 @@
1
- DIGITALOCEAN_CLIENT_ID=
2
- DIGITALOCEAN_API_KEY=
@@ -1,34 +0,0 @@
1
- module Digitalocean
2
- class Domain
3
- #
4
- # Api calls
5
- #
6
- def self.all
7
- response = Digitalocean.request.get "domains"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
-
11
- def self.find(domain_id)
12
- response = Digitalocean.request.get "domains/#{domain_id}"
13
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
14
- end
15
-
16
- # attrs = {
17
- # :name => domain_name,
18
- # :ip_address => ip_address
19
- # }
20
- def self.create(domain_name, ip_address)
21
- attrs = {
22
- name: domain_name,
23
- ip_address: ip_address
24
- }
25
- response = Digitalocean.request.get "domains/new", attrs
26
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
27
- end
28
-
29
- def self.destroy(domain_id)
30
- response = Digitalocean.request.get "domains/#{domain_id}/destroy"
31
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
32
- end
33
- end
34
- end
@@ -1,67 +0,0 @@
1
- module Digitalocean
2
- class Droplet
3
- #
4
- # Api calls
5
- #
6
- def self.all
7
- response = Digitalocean.request.get "droplets"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
-
11
- def self.retrieve(droplet_id)
12
- response = Digitalocean.request.get "droplets/#{droplet_id}"
13
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
14
- end
15
-
16
- def self.rename(droplet_id, name)
17
- response = Digitalocean.request.get "droplets/#{droplet_id}/rename", :name=>name
18
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
19
- end
20
-
21
- def self.reboot(droplet_id=nil)
22
- response = Digitalocean.request.get "droplets/#{droplet_id}/reboot"
23
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
24
- end
25
-
26
- def self.power_cycle(droplet_id=nil)
27
- response = Digitalocean.request.get "droplets/#{droplet_id}/power_cycle"
28
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
29
- end
30
-
31
- def self.shut_down(droplet_id=nil)
32
- response = Digitalocean.request.get "droplets/#{droplet_id}/shut_down"
33
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
34
- end
35
-
36
- def self.power_off(droplet_id=nil)
37
- response = Digitalocean.request.get "droplets/#{droplet_id}/power_off"
38
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
39
- end
40
-
41
- def self.power_on(droplet_id=nil)
42
- response = Digitalocean.request.get "droplets/#{droplet_id}/power_on"
43
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
44
- end
45
-
46
- def self.snapshot(droplet_id=nil, snapshot_name=nil)
47
- response = Digitalocean.request.get "droplets/#{droplet_id}/snapshot", {:name => snapshot_name}
48
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
49
- end
50
-
51
- # attrs = {
52
- # :name => droplet_name,
53
- # :size_id => size_id,
54
- # :image_id => image_id,
55
- # :region_id => region_id
56
- # }
57
- def self.create(attrs)
58
- response = Digitalocean.request.get "droplets/new", attrs
59
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
60
- end
61
-
62
- def self.destroy(droplet_id=nil)
63
- response = Digitalocean.request.get "droplets/#{droplet_id}/destroy"
64
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
65
- end
66
- end
67
- end