digital_ocean 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/CHANGELOG.md +40 -0
- data/LICENSE.txt +1 -1
- data/README.md +114 -2
- data/digital_ocean.gemspec +1 -0
- data/doc/DigitalOcean/API.html +844 -0
- data/doc/DigitalOcean/AuthenticationMiddleware.html +342 -0
- data/doc/DigitalOcean/Resource/Base.html +206 -0
- data/doc/DigitalOcean/Resource/Droplet.html +1016 -0
- data/doc/DigitalOcean/Resource/Image.html +312 -0
- data/doc/DigitalOcean/Resource/Region.html +247 -0
- data/doc/DigitalOcean/Resource/SSHKey.html +312 -0
- data/doc/DigitalOcean/Resource/Size.html +208 -0
- data/doc/DigitalOcean/Resource.html +117 -0
- data/doc/DigitalOcean.html +131 -0
- data/doc/_index.html +213 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +402 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +402 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +332 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/digital_ocean/api.rb +28 -0
- data/lib/digital_ocean/resource/droplet.rb +2 -2
- data/lib/digital_ocean/resource/region.rb +3 -0
- data/lib/digital_ocean/version.rb +1 -1
- data/spec/api_spec.rb +8 -4
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_be_successful.yml +7 -5
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_return_droplet_id.yml +50 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_delete/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_disable_backups/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_enable_backups/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_list/should_be_successful.yml +7 -5
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_list/should_return_a_list_of_all_droplets.yml +7 -5
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/{_reset_root_password → _password_reset}/should_be_successful.yml +10 -9
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_cycle/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_off/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_on/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_reboot/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_rebuild/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_resize/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_restore/should_be_successful.yml +1 -1
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_show/should_be_successful.yml +6 -4
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_shutdown/should_be_successful.yml +8 -6
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_snapshot/should_be_successful.yml +8 -6
- metadata +34 -7
@@ -0,0 +1,332 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<base id="base_target" target="_parent" />
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<script type="text/javascript" charset="utf-8">
|
22
|
+
if (window.top.frames.main) {
|
23
|
+
document.getElementById('base_target').target = 'main';
|
24
|
+
document.body.className = 'frames';
|
25
|
+
}
|
26
|
+
</script>
|
27
|
+
<div id="content">
|
28
|
+
<h1 id="full_list_header">Method List</h1>
|
29
|
+
<div id="nav">
|
30
|
+
|
31
|
+
<span><a target="_self" href="class_list.html">
|
32
|
+
Classes
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="method_list.html">
|
36
|
+
Methods
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
<span><a target="_self" href="file_list.html">
|
40
|
+
Files
|
41
|
+
</a></span>
|
42
|
+
|
43
|
+
</div>
|
44
|
+
<div id="search">Search: <input type="text" /></div>
|
45
|
+
|
46
|
+
<ul id="full_list" class="method">
|
47
|
+
|
48
|
+
|
49
|
+
<li class="r1 ">
|
50
|
+
<span class='object_link'><a href="DigitalOcean/AuthenticationMiddleware.html#call-instance_method" title="DigitalOcean::AuthenticationMiddleware#call (method)">#call</a></span>
|
51
|
+
|
52
|
+
<small>DigitalOcean::AuthenticationMiddleware</small>
|
53
|
+
|
54
|
+
</li>
|
55
|
+
|
56
|
+
|
57
|
+
<li class="r2 ">
|
58
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#create-instance_method" title="DigitalOcean::Resource::Droplet#create (method)">#create</a></span>
|
59
|
+
|
60
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
61
|
+
|
62
|
+
</li>
|
63
|
+
|
64
|
+
|
65
|
+
<li class="r1 ">
|
66
|
+
<span class='object_link'><a href="DigitalOcean/API.html#default_faraday-instance_method" title="DigitalOcean::API#default_faraday (method)">#default_faraday</a></span>
|
67
|
+
|
68
|
+
<small>DigitalOcean::API</small>
|
69
|
+
|
70
|
+
</li>
|
71
|
+
|
72
|
+
|
73
|
+
<li class="r2 ">
|
74
|
+
<span class='object_link'><a href="DigitalOcean/Resource/SSHKey.html#delete-instance_method" title="DigitalOcean::Resource::SSHKey#delete (method)">#delete</a></span>
|
75
|
+
|
76
|
+
<small>DigitalOcean::Resource::SSHKey</small>
|
77
|
+
|
78
|
+
</li>
|
79
|
+
|
80
|
+
|
81
|
+
<li class="r1 ">
|
82
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#delete-instance_method" title="DigitalOcean::Resource::Droplet#delete (method)">#delete</a></span>
|
83
|
+
|
84
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
85
|
+
|
86
|
+
</li>
|
87
|
+
|
88
|
+
|
89
|
+
<li class="r2 ">
|
90
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Image.html#delete-instance_method" title="DigitalOcean::Resource::Image#delete (method)">#delete</a></span>
|
91
|
+
|
92
|
+
<small>DigitalOcean::Resource::Image</small>
|
93
|
+
|
94
|
+
</li>
|
95
|
+
|
96
|
+
|
97
|
+
<li class="r1 ">
|
98
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#disable_backups-instance_method" title="DigitalOcean::Resource::Droplet#disable_backups (method)">#disable_backups</a></span>
|
99
|
+
|
100
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
101
|
+
|
102
|
+
</li>
|
103
|
+
|
104
|
+
|
105
|
+
<li class="r2 ">
|
106
|
+
<span class='object_link'><a href="DigitalOcean/API.html#droplets-instance_method" title="DigitalOcean::API#droplets (method)">#droplets</a></span>
|
107
|
+
|
108
|
+
<small>DigitalOcean::API</small>
|
109
|
+
|
110
|
+
</li>
|
111
|
+
|
112
|
+
|
113
|
+
<li class="r1 ">
|
114
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#enable_backups-instance_method" title="DigitalOcean::Resource::Droplet#enable_backups (method)">#enable_backups</a></span>
|
115
|
+
|
116
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
117
|
+
|
118
|
+
</li>
|
119
|
+
|
120
|
+
|
121
|
+
<li class="r2 ">
|
122
|
+
<span class='object_link'><a href="DigitalOcean/API.html#images-instance_method" title="DigitalOcean::API#images (method)">#images</a></span>
|
123
|
+
|
124
|
+
<small>DigitalOcean::API</small>
|
125
|
+
|
126
|
+
</li>
|
127
|
+
|
128
|
+
|
129
|
+
<li class="r1 ">
|
130
|
+
<span class='object_link'><a href="DigitalOcean/API.html#initialize-instance_method" title="DigitalOcean::API#initialize (method)">#initialize</a></span>
|
131
|
+
|
132
|
+
<small>DigitalOcean::API</small>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
<li class="r2 ">
|
138
|
+
<span class='object_link'><a href="DigitalOcean/AuthenticationMiddleware.html#initialize-instance_method" title="DigitalOcean::AuthenticationMiddleware#initialize (method)">#initialize</a></span>
|
139
|
+
|
140
|
+
<small>DigitalOcean::AuthenticationMiddleware</small>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
<li class="r1 ">
|
146
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Base.html#initialize-instance_method" title="DigitalOcean::Resource::Base#initialize (method)">#initialize</a></span>
|
147
|
+
|
148
|
+
<small>DigitalOcean::Resource::Base</small>
|
149
|
+
|
150
|
+
</li>
|
151
|
+
|
152
|
+
|
153
|
+
<li class="r2 ">
|
154
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Size.html#list-instance_method" title="DigitalOcean::Resource::Size#list (method)">#list</a></span>
|
155
|
+
|
156
|
+
<small>DigitalOcean::Resource::Size</small>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="r1 ">
|
162
|
+
<span class='object_link'><a href="DigitalOcean/Resource/SSHKey.html#list-instance_method" title="DigitalOcean::Resource::SSHKey#list (method)">#list</a></span>
|
163
|
+
|
164
|
+
<small>DigitalOcean::Resource::SSHKey</small>
|
165
|
+
|
166
|
+
</li>
|
167
|
+
|
168
|
+
|
169
|
+
<li class="r2 ">
|
170
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Region.html#list-instance_method" title="DigitalOcean::Resource::Region#list (method)">#list</a></span>
|
171
|
+
|
172
|
+
<small>DigitalOcean::Resource::Region</small>
|
173
|
+
|
174
|
+
</li>
|
175
|
+
|
176
|
+
|
177
|
+
<li class="r1 ">
|
178
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Image.html#list-instance_method" title="DigitalOcean::Resource::Image#list (method)">#list</a></span>
|
179
|
+
|
180
|
+
<small>DigitalOcean::Resource::Image</small>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="r2 ">
|
186
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#list-instance_method" title="DigitalOcean::Resource::Droplet#list (method)">#list</a></span>
|
187
|
+
|
188
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
189
|
+
|
190
|
+
</li>
|
191
|
+
|
192
|
+
|
193
|
+
<li class="r1 ">
|
194
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#password_reset-instance_method" title="DigitalOcean::Resource::Droplet#password_reset (method)">#password_reset</a></span>
|
195
|
+
|
196
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="r2 ">
|
202
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#power_cycle-instance_method" title="DigitalOcean::Resource::Droplet#power_cycle (method)">#power_cycle</a></span>
|
203
|
+
|
204
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
205
|
+
|
206
|
+
</li>
|
207
|
+
|
208
|
+
|
209
|
+
<li class="r1 ">
|
210
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#power_off-instance_method" title="DigitalOcean::Resource::Droplet#power_off (method)">#power_off</a></span>
|
211
|
+
|
212
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
<li class="r2 ">
|
218
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#power_on-instance_method" title="DigitalOcean::Resource::Droplet#power_on (method)">#power_on</a></span>
|
219
|
+
|
220
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="r1 ">
|
226
|
+
<span class='object_link'><a href="DigitalOcean/AuthenticationMiddleware.html#query_params-instance_method" title="DigitalOcean::AuthenticationMiddleware#query_params (method)">#query_params</a></span>
|
227
|
+
|
228
|
+
<small>DigitalOcean::AuthenticationMiddleware</small>
|
229
|
+
|
230
|
+
</li>
|
231
|
+
|
232
|
+
|
233
|
+
<li class="r2 ">
|
234
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#reboot-instance_method" title="DigitalOcean::Resource::Droplet#reboot (method)">#reboot</a></span>
|
235
|
+
|
236
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
<li class="r1 ">
|
242
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#rebuild-instance_method" title="DigitalOcean::Resource::Droplet#rebuild (method)">#rebuild</a></span>
|
243
|
+
|
244
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
245
|
+
|
246
|
+
</li>
|
247
|
+
|
248
|
+
|
249
|
+
<li class="r2 ">
|
250
|
+
<span class='object_link'><a href="DigitalOcean/API.html#regions-instance_method" title="DigitalOcean::API#regions (method)">#regions</a></span>
|
251
|
+
|
252
|
+
<small>DigitalOcean::API</small>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
|
257
|
+
<li class="r1 ">
|
258
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#resize-instance_method" title="DigitalOcean::Resource::Droplet#resize (method)">#resize</a></span>
|
259
|
+
|
260
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
261
|
+
|
262
|
+
</li>
|
263
|
+
|
264
|
+
|
265
|
+
<li class="r2 ">
|
266
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#restore-instance_method" title="DigitalOcean::Resource::Droplet#restore (method)">#restore</a></span>
|
267
|
+
|
268
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="r1 ">
|
274
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#show-instance_method" title="DigitalOcean::Resource::Droplet#show (method)">#show</a></span>
|
275
|
+
|
276
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
277
|
+
|
278
|
+
</li>
|
279
|
+
|
280
|
+
|
281
|
+
<li class="r2 ">
|
282
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Image.html#show-instance_method" title="DigitalOcean::Resource::Image#show (method)">#show</a></span>
|
283
|
+
|
284
|
+
<small>DigitalOcean::Resource::Image</small>
|
285
|
+
|
286
|
+
</li>
|
287
|
+
|
288
|
+
|
289
|
+
<li class="r1 ">
|
290
|
+
<span class='object_link'><a href="DigitalOcean/Resource/SSHKey.html#show-instance_method" title="DigitalOcean::Resource::SSHKey#show (method)">#show</a></span>
|
291
|
+
|
292
|
+
<small>DigitalOcean::Resource::SSHKey</small>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
<li class="r2 ">
|
298
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#shutdown-instance_method" title="DigitalOcean::Resource::Droplet#shutdown (method)">#shutdown</a></span>
|
299
|
+
|
300
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
301
|
+
|
302
|
+
</li>
|
303
|
+
|
304
|
+
|
305
|
+
<li class="r1 ">
|
306
|
+
<span class='object_link'><a href="DigitalOcean/API.html#sizes-instance_method" title="DigitalOcean::API#sizes (method)">#sizes</a></span>
|
307
|
+
|
308
|
+
<small>DigitalOcean::API</small>
|
309
|
+
|
310
|
+
</li>
|
311
|
+
|
312
|
+
|
313
|
+
<li class="r2 ">
|
314
|
+
<span class='object_link'><a href="DigitalOcean/Resource/Droplet.html#snapshot-instance_method" title="DigitalOcean::Resource::Droplet#snapshot (method)">#snapshot</a></span>
|
315
|
+
|
316
|
+
<small>DigitalOcean::Resource::Droplet</small>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
|
321
|
+
<li class="r1 ">
|
322
|
+
<span class='object_link'><a href="DigitalOcean/API.html#ssh_keys-instance_method" title="DigitalOcean::API#ssh_keys (method)">#ssh_keys</a></span>
|
323
|
+
|
324
|
+
<small>DigitalOcean::API</small>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
|
329
|
+
</ul>
|
330
|
+
</div>
|
331
|
+
</body>
|
332
|
+
</html>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Top Level Namespace</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Top Level Namespace
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Defined Under Namespace</h2>
|
85
|
+
<p class="children">
|
86
|
+
|
87
|
+
|
88
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="DigitalOcean.html" title="DigitalOcean (module)">DigitalOcean</a></span>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
</p>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div id="footer">
|
106
|
+
Generated on Wed Feb 20 12:33:48 2013 by
|
107
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
+
0.8.3 (ruby-1.9.3).
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
data/lib/digital_ocean/api.rb
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
module DigitalOcean
|
2
2
|
class API
|
3
|
+
# Creates a new API client instance.
|
4
|
+
#
|
5
|
+
# @param [Hash] params
|
6
|
+
# @option params [String] :client_id The client_id (required)
|
7
|
+
# @option params [String] :api_key The api_key (required)
|
8
|
+
# @option params [String] :base_url ('https://api.digitalocean.com/') API base url
|
9
|
+
# @option params [Symbol] :faraday_adapter ('Faraday.default_adapter') Faraday adapter/http client library to use.
|
10
|
+
# @raise [ArgumentError] when no client_id is provided
|
11
|
+
# @raise [ArgumentError] when no api_key is provided
|
12
|
+
# @example
|
13
|
+
# client = DigitalOcean::API.new :client_id => '######', :api_key => '#######'
|
14
|
+
#
|
15
|
+
# @see [Faraday]
|
3
16
|
def initialize(params)
|
4
17
|
@client_id = params[:client_id]
|
5
18
|
@api_key = params[:api_key]
|
@@ -12,22 +25,37 @@ module DigitalOcean
|
|
12
25
|
raise ArgumentError, ':api_key missing' unless @api_key
|
13
26
|
end
|
14
27
|
|
28
|
+
# Access Droplets (virtual machines)
|
29
|
+
# @see DigitalOcean::Resource::Droplet
|
30
|
+
# @return [DigitalOcean::Resource::Droplet]
|
15
31
|
def droplets
|
16
32
|
DigitalOcean::Resource::Droplet.new(@faraday)
|
17
33
|
end
|
18
34
|
|
35
|
+
# Access Sizes (virtual machine types/sizes)
|
36
|
+
# @see DigitalOcean::Resource::Size
|
37
|
+
# @return [DigitalOcean::Resource::Size]
|
19
38
|
def sizes
|
20
39
|
DigitalOcean::Resource::Size.new(@faraday)
|
21
40
|
end
|
22
41
|
|
42
|
+
# Access Regions (data center location)
|
43
|
+
# @see DigitalOcean::Resource::Region
|
44
|
+
# @return [DigitalOcean::Resource::Region]
|
23
45
|
def regions
|
24
46
|
DigitalOcean::Resource::Region.new(@faraday)
|
25
47
|
end
|
26
48
|
|
49
|
+
# Access SSH keys
|
50
|
+
# @see DigitalOcean::Resource::SSHKey
|
51
|
+
# @return [DigitalOcean::Resource::SSHKey]
|
27
52
|
def ssh_keys
|
28
53
|
DigitalOcean::Resource::SSHKey.new(@faraday)
|
29
54
|
end
|
30
55
|
|
56
|
+
# Access Images (Snapshots, Backups)
|
57
|
+
# @see DigitalOcean::Resource::Image
|
58
|
+
# @return [DigitalOcean::Resource::Image]
|
31
59
|
def images
|
32
60
|
DigitalOcean::Resource::Image.new(@faraday)
|
33
61
|
end
|
@@ -40,8 +40,8 @@ module DigitalOcean
|
|
40
40
|
@connection.put("/droplets/#{id}/power_off").body
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
@connection.post("/droplets/#{id}/
|
43
|
+
def password_reset(id)
|
44
|
+
@connection.post("/droplets/#{id}/password_reset").body
|
45
45
|
end
|
46
46
|
|
47
47
|
def resize(id, params)
|
data/spec/api_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe DigitalOcean::API, :vcr do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '#droplets' do
|
16
|
-
let(:droplet_id) {
|
16
|
+
let(:droplet_id) { 106265 }
|
17
17
|
|
18
18
|
describe '#list' do
|
19
19
|
let(:response) {
|
@@ -59,6 +59,10 @@ describe DigitalOcean::API, :vcr do
|
|
59
59
|
# #<Hashie::Rash droplet=#<Hashie::Rash event_id=123456 id=87071 image_id=25306 name="t1" size_id=66> status="OK">
|
60
60
|
response.status.should eql('OK')
|
61
61
|
end
|
62
|
+
|
63
|
+
it 'should return droplet.id' do
|
64
|
+
response.droplet.id.should_not be_nil
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
describe '#reboot' do
|
@@ -116,13 +120,13 @@ describe DigitalOcean::API, :vcr do
|
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
119
|
-
describe '#
|
123
|
+
describe '#password_reset' do
|
120
124
|
let(:response) {
|
121
|
-
subject.droplets.
|
125
|
+
subject.droplets.password_reset droplet_id
|
122
126
|
}
|
123
127
|
|
124
128
|
it 'should be successful' do
|
125
|
-
|
129
|
+
# an mail with login/password is triggered...
|
126
130
|
#<Hashie::Rash event_id=123456 status="OK">
|
127
131
|
response.status.should eql('OK')
|
128
132
|
end
|
@@ -15,7 +15,7 @@ http_interactions:
|
|
15
15
|
server:
|
16
16
|
- nginx
|
17
17
|
date:
|
18
|
-
-
|
18
|
+
- Wed, 20 Feb 2013 11:05:16 GMT
|
19
19
|
content-type:
|
20
20
|
- application/json; charset=utf-8
|
21
21
|
transfer-encoding:
|
@@ -26,6 +26,8 @@ http_interactions:
|
|
26
26
|
- '200'
|
27
27
|
x-powered-by:
|
28
28
|
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
strict-transport-security:
|
30
|
+
- max-age=31536000
|
29
31
|
x-ua-compatible:
|
30
32
|
- IE=Edge,chrome=1
|
31
33
|
etag:
|
@@ -35,14 +37,14 @@ http_interactions:
|
|
35
37
|
set-cookie:
|
36
38
|
- _digitalocean2_session=wtf
|
37
39
|
x-request-id:
|
38
|
-
-
|
40
|
+
- f160f34639183afd5f552d2af4b05db7
|
39
41
|
x-runtime:
|
40
|
-
- '
|
42
|
+
- '0.333447'
|
41
43
|
x-rack-cache:
|
42
44
|
- miss
|
43
45
|
body:
|
44
46
|
encoding: US-ASCII
|
45
|
-
string: ! '{"status":"OK","droplet":{"id":
|
47
|
+
string: ! '{"status":"OK","droplet":{"id":106267,"name":"t1","image_id":25306,"size_id":66,"event_id":765542}}'
|
46
48
|
http_version:
|
47
|
-
recorded_at:
|
49
|
+
recorded_at: Wed, 20 Feb 2013 11:05:16 GMT
|
48
50
|
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.digitalocean.com/droplets/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&name=t1&size_id=66&image_id=25306®ion_id=2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message:
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx
|
17
|
+
date:
|
18
|
+
- Wed, 20 Feb 2013 11:05:17 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- close
|
25
|
+
status:
|
26
|
+
- '200'
|
27
|
+
x-powered-by:
|
28
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
strict-transport-security:
|
30
|
+
- max-age=31536000
|
31
|
+
x-ua-compatible:
|
32
|
+
- IE=Edge,chrome=1
|
33
|
+
etag:
|
34
|
+
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
35
|
+
cache-control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
set-cookie:
|
38
|
+
- _digitalocean2_session=wtf
|
39
|
+
x-request-id:
|
40
|
+
- d097a842d4b298770e6700b4999582cc
|
41
|
+
x-runtime:
|
42
|
+
- '0.530933'
|
43
|
+
x-rack-cache:
|
44
|
+
- miss
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ! '{"status":"OK","droplet":{"id":106268,"name":"t1","image_id":25306,"size_id":66,"event_id":765543}}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Wed, 20 Feb 2013 11:05:17 GMT
|
50
|
+
recorded_with: VCR 2.4.0
|