digitalocean 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -6
- data/example.png +0 -0
- data/lib/digitalocean.rb +1 -1
- data/lib/digitalocean/version.rb +1 -1
- data/spec/digitalocean/droplet_spec.rb +3 -3
- data/spec/digitalocean_spec.rb +1 -1
- metadata +2 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Digitalocean Ruby Bindings
|
2
2
|
|
3
|
-
|
3
|
+
### The easiest and most complete rubygem for [DigitalOcean](https://www.digitalocean.com).
|
4
4
|
|
5
5
|
[![BuildStatus](https://travis-ci.org/scottmotte/digitalocean.png?branch=master)](https://travis-ci.org/scottmotte/digitalocean)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/digitalocean.png)](http://badge.fury.io/rb/digitalocean)
|
@@ -8,8 +8,17 @@ This gem is a wrapper for [DigitalOcean.com](https://www.digitalocean.com)'s API
|
|
8
8
|
```ruby
|
9
9
|
Digitalocean.client_id = "your_client_id"
|
10
10
|
Digitalocean.api_key = "your_api_key"
|
11
|
-
|
12
|
-
|
11
|
+
result = Digitalocean::Droplet.all
|
12
|
+
# =>
|
13
|
+
# <RecursiveOpenStruct status="OK", droplets=[
|
14
|
+
# {"id"=>12345, "name"=>"dev", "image_id"=>2676, "size_id"=>63, "region_id"=>3, "backups_active"=>false, "ip_address"=>"198.555.55.55", "private_ip_address"=>nil, "locked"=>false, "status"=>"active", "created_at"=>"2013-06-12T03:07:14Z"},
|
15
|
+
# {"id"=>234674, "name"=>"server2", "image_id"=>441012, "size_id"=>62, "region_id"=>1, "backups_active"=>false, "ip_address"=>"192.555.55.56", "private_ip_address"=>nil, "locked"=>false, "status"=>"active", "created_at"=>"2013-06-17T00:30:12Z"}
|
16
|
+
# ]>
|
17
|
+
#
|
18
|
+
|
19
|
+
result.status
|
20
|
+
result.droplets
|
21
|
+
result.droplets.first.ip_address
|
13
22
|
```
|
14
23
|
|
15
24
|
## Installation
|
@@ -39,6 +48,10 @@ Digitalocean.client_id = "your_client_id"
|
|
39
48
|
Digitalocean.api_key = "your_api_key"
|
40
49
|
```
|
41
50
|
|
51
|
+
You can find your keys at [https://cloud.digitalocean.com/api_access](https://cloud.digitalocean.com/api_access)
|
52
|
+
|
53
|
+
[![](https://raw2.github.com/scottmotte/digitalocean/master/example.png)](https://cloud.digitalocean.com/api_access)
|
54
|
+
|
42
55
|
## Usage
|
43
56
|
|
44
57
|
### List Droplets
|
@@ -71,7 +84,7 @@ Digitalocean::Droplet.find(id)
|
|
71
84
|
Digitalocean::Droplet.rename(id, {name: name})
|
72
85
|
Digitalocean::Droplet.reboot(id)
|
73
86
|
Digitalocean::Droplet.power_cycle(id)
|
74
|
-
Digitalocean::Droplet.
|
87
|
+
Digitalocean::Droplet.shutdown(id)
|
75
88
|
Digitalocean::Droplet.power_off(id)
|
76
89
|
Digitalocean::Droplet.power_on(id)
|
77
90
|
Digitalocean::Droplet.snapshot(id, {name: name})
|
@@ -101,7 +114,9 @@ Digitalocean::SshKey.create({name: name, ssh_pub_key: ssh_pub_key})
|
|
101
114
|
Digitalocean::Event.find(id)
|
102
115
|
```
|
103
116
|
|
104
|
-
|
117
|
+
## Example
|
118
|
+
|
119
|
+
There is a [digitalocean-rubygem-example](https://github.com/scottmotte/digitalocean-rubygem-example) to help jumpstart your development.
|
105
120
|
|
106
121
|
## Contributing
|
107
122
|
|
@@ -125,5 +140,5 @@ You first need to request access from [scottmotte](http://github.com/scottmotte)
|
|
125
140
|
|
126
141
|
```
|
127
142
|
gem build digitalocean.gemspec
|
128
|
-
gem push digitalocean-1.0.
|
143
|
+
gem push digitalocean-1.0.1.gem
|
129
144
|
```
|
data/example.png
ADDED
Binary file
|
data/lib/digitalocean.rb
CHANGED
@@ -19,7 +19,7 @@ module Digitalocean
|
|
19
19
|
"rename" => "https://api.digitalocean.com/droplets/[droplet_id]/rename/?client_id=[your_client_id]&api_key=[your_api_key]&name=[name]",
|
20
20
|
"reboot" => "https://api.digitalocean.com/droplets/[droplet_id]/reboot/?client_id=[your_client_id]&api_key=[your_api_key]",
|
21
21
|
"power_cycle" => "https://api.digitalocean.com/droplets/[droplet_id]/power_cycle/?client_id=[your_client_id]&api_key=[your_api_key]",
|
22
|
-
"
|
22
|
+
"shutdown" => "https://api.digitalocean.com/droplets/[droplet_id]/shutdown/?client_id=[your_client_id]&api_key=[your_api_key]",
|
23
23
|
"power_off" => "https://api.digitalocean.com/droplets/[droplet_id]/power_off/?client_id=[your_client_id]&api_key=[your_api_key]",
|
24
24
|
"power_on" => "https://api.digitalocean.com/droplets/[droplet_id]/power_on/?client_id=[your_client_id]&api_key=[your_api_key]",
|
25
25
|
"snapshot" => "https://api.digitalocean.com/droplets/[droplet_id]/snapshot/?name=[snapshot_name]&client_id=[your_client_id]&api_key=[your_api_key]",
|
data/lib/digitalocean/version.rb
CHANGED
@@ -62,15 +62,15 @@ describe Digitalocean::Droplet do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe ".
|
65
|
+
describe "._shutdown" do
|
66
66
|
let(:droplet_id) { "1234" }
|
67
67
|
|
68
68
|
before do
|
69
|
-
@url = subject.
|
69
|
+
@url = subject._shutdown(droplet_id)
|
70
70
|
end
|
71
71
|
|
72
72
|
it do
|
73
|
-
@url.should eq "https://api.digitalocean.com/droplets/#{droplet_id}/
|
73
|
+
@url.should eq "https://api.digitalocean.com/droplets/#{droplet_id}/shutdown/?client_id=client_id_required&api_key=api_key_required"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
data/spec/digitalocean_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Digitalocean do
|
|
12
12
|
it { subject.api_endpoint.should eq "https://api.digitalocean.com" }
|
13
13
|
it { subject.client_id.should eq "client_id_required" }
|
14
14
|
it { subject.api_key.should eq "api_key_required" }
|
15
|
-
it { subject::VERSION.should eq "1.0.
|
15
|
+
it { subject::VERSION.should eq "1.0.1" }
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "setting values" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digitalocean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- README.md
|
141
141
|
- Rakefile
|
142
142
|
- digitalocean.gemspec
|
143
|
+
- example.png
|
143
144
|
- lib/digitalocean.rb
|
144
145
|
- lib/digitalocean/version.rb
|
145
146
|
- spec/digitalocean/domain_spec.rb
|