digital_ocean 0.0.1alpha1 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/LICENSE.txt +2 -2
- data/README.md +84 -3
- data/digital_ocean.gemspec +1 -0
- data/lib/digital_ocean/version.rb +1 -1
- metadata +10 -6
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2013
|
1
|
+
Copyright (c) 2013 Moriz GmbH
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# DigitalOcean
|
2
|
+
[![Build Status](https://travis-ci.org/rmoriz/digital_ocean.png)](https://travis-ci.org/rmoriz/digital_ocean)
|
2
3
|
|
3
|
-
|
4
|
+
DigitalOcean provides simple cloud hosting. Create and delete
|
5
|
+
SSD-based virtual machines within seconds for a very affordable price.
|
4
6
|
|
5
|
-
|
7
|
+
Go to https://www.digitalocean.com/ for more information.
|
8
|
+
|
9
|
+
This gem is a simple ruby wrapper for the HTTP API of DigitalOcean using
|
10
|
+
the great [Faraday](https://github.com/lostisland/faraday) library.
|
6
11
|
|
7
12
|
|
8
13
|
## Installation
|
@@ -19,9 +24,76 @@ Or install it yourself as:
|
|
19
24
|
|
20
25
|
$ gem install digital_ocean
|
21
26
|
|
27
|
+
## Prerequisite: Create an account and API credentials
|
28
|
+
|
29
|
+
[![Create API credentials](http://i.imgur.com/1iYdSFF.png)](https://www.digitalocean.com/login)
|
30
|
+
|
22
31
|
## Usage
|
23
32
|
|
24
|
-
|
33
|
+
### Examples
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require 'digital_ocean'
|
37
|
+
|
38
|
+
# 1. create a client instance
|
39
|
+
#
|
40
|
+
dc = DigitalOcean::API.new :client_id => 'YOUR_CLIENT_ID',
|
41
|
+
:api_key => 'YOUR_API_KEY'
|
42
|
+
|
43
|
+
# 2. get all regions (server locations)
|
44
|
+
#
|
45
|
+
res = dc.regions.list
|
46
|
+
res.regions.size # => 2
|
47
|
+
res.regions.first.name # => "New York 1"
|
48
|
+
|
49
|
+
# 3. get all available machine types (sizes)
|
50
|
+
#
|
51
|
+
res = dc.sizes.list
|
52
|
+
res.sizes
|
53
|
+
# => [#<Hashie::Rash id=66 name="512MB">,
|
54
|
+
# #<Hashie::Rash id=63 name="1GB">,
|
55
|
+
# #<Hashie::Rash id=62 name="2GB">,
|
56
|
+
# #<Hashie::Rash id=64 name="4GB">,
|
57
|
+
# #<Hashie::Rash id=65 name="8GB">,
|
58
|
+
# #<Hashie::Rash id=61 name="16GB">,
|
59
|
+
# #<Hashie::Rash id=60 name="32GB">,
|
60
|
+
# #<Hashie::Rash id=70 name="48GB">,
|
61
|
+
# #<Hashie::Rash id=69 name="64GB">,
|
62
|
+
# #<Hashie::Rash id=68 name="96GB">]
|
63
|
+
|
64
|
+
# 4. get all available images (e.g. OS-Images, snapshots, backups)
|
65
|
+
#
|
66
|
+
res = dc.images.list
|
67
|
+
res.images
|
68
|
+
# => [#<Hashie::Rash distribution="CentOS" id=1601 name="CentOS 5.8 x64">,
|
69
|
+
# #<Hashie::Rash distribution="CentOS" id=1602 name="CentOS 5.8 x32">,
|
70
|
+
# ...
|
71
|
+
# #<Hashie::Rash distribution="Ubuntu" id=2676 name="Ubuntu 12.04 x64 Server">,
|
72
|
+
# ...
|
73
|
+
# #<Hashie::Rash distribution="Ubuntu" id=25306 name="Ubuntu 12.10 x32 Server">,
|
74
|
+
# ...]
|
75
|
+
|
76
|
+
# 5. start a new instance (called droplet)
|
77
|
+
#
|
78
|
+
res = dc.droplets.create :name => 'new_hostname',
|
79
|
+
:size_id => 64,
|
80
|
+
:image_id => 2676,
|
81
|
+
:region_id => 1
|
82
|
+
|
83
|
+
# 6. query droplet status (e.g. to get the IP of a droplet)
|
84
|
+
#
|
85
|
+
res = dc.droplets.list
|
86
|
+
res.droplets
|
87
|
+
# => [#<Hashie::Rash backups_active=false id=123456
|
88
|
+
# image_id=25306 ip_address="123.123.123.123"
|
89
|
+
# name="new_hostname" region_id=1 size_id=64
|
90
|
+
# status="active">]
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
see ```spec/api_spec.rb``` for more details and all implemented
|
95
|
+
resources.
|
96
|
+
|
25
97
|
|
26
98
|
## Contributing
|
27
99
|
|
@@ -30,3 +102,12 @@ TODO: Write usage instructions here
|
|
30
102
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
103
|
4. Push to the branch (`git push origin my-new-feature`)
|
32
104
|
5. Create new Pull Request
|
105
|
+
|
106
|
+
## License
|
107
|
+
|
108
|
+
MIT
|
109
|
+
|
110
|
+
## Copyright
|
111
|
+
|
112
|
+
2013 Moriz GmbH, https://moriz.de/
|
113
|
+
|
data/digital_ocean.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{A Ruby gem to interact with DigitalOcean, a cloud hosting provider}
|
12
12
|
gem.summary = %q{This gem wraps the DigitalOcean API documented at https://api.digitalocean.com/}
|
13
13
|
gem.homepage = 'https://github.com/rmoriz/digital_ocean'
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digital_ocean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Roland Moriz
|
@@ -277,7 +277,8 @@ files:
|
|
277
277
|
- spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/valid/should_return_a_list_of_all_SSH_keys.yml
|
278
278
|
- spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/valid/should_return_the_public_keykey.yml
|
279
279
|
homepage: https://github.com/rmoriz/digital_ocean
|
280
|
-
licenses:
|
280
|
+
licenses:
|
281
|
+
- MIT
|
281
282
|
post_install_message:
|
282
283
|
rdoc_options: []
|
283
284
|
require_paths:
|
@@ -290,13 +291,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
291
|
version: '0'
|
291
292
|
segments:
|
292
293
|
- 0
|
293
|
-
hash: -
|
294
|
+
hash: -4331574479850875147
|
294
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
296
|
none: false
|
296
297
|
requirements:
|
297
|
-
- - ! '
|
298
|
+
- - ! '>='
|
298
299
|
- !ruby/object:Gem::Version
|
299
|
-
version:
|
300
|
+
version: '0'
|
301
|
+
segments:
|
302
|
+
- 0
|
303
|
+
hash: -4331574479850875147
|
300
304
|
requirements: []
|
301
305
|
rubyforge_project:
|
302
306
|
rubygems_version: 1.8.23
|