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,23 +0,0 @@
1
- module Digitalocean
2
- class Image
3
- #
4
- # Api calls
5
- #
6
- def self.all(attrs={})
7
- response = Digitalocean.request.get "images", attrs
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
- def self.find(id)
11
- response = Digitalocean.request.get "images/#{id}"
12
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true).image
13
- end
14
- def self.destroy(id)
15
- response = Digitalocean.request.get "images/#{id}/destroy"
16
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true).image
17
- end
18
- def self.transfer(id, region_id)
19
- response = Digitalocean.request.get "images/#{id}/transfer", { region_id: region_id }
20
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true).image
21
- end
22
- end
23
- end
@@ -1,62 +0,0 @@
1
- module Digitalocean
2
- class Record
3
- #
4
- # Api calls
5
- #
6
- def self.all(domain_id)
7
- response = Digitalocean.request.get "domains/#{domain_id}/records"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
-
11
- def self.find(domain_id, record_id)
12
- response = Digitalocean.request.get "domains/#{domain_id}/records/#{record_id}"
13
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
14
- end
15
-
16
- # attrs = {
17
- # :domain_id => domain_id || domain_name,
18
- # :record_type => 'A' || 'CNAME' || 'NS' || 'TXT' || 'MX' || 'SRV',
19
- # :data => '@' || '123.123.123.123' || ...,
20
- # :name => optional, required for A, CNAME, TXT, and SRV records,
21
- # :priority => optional, required for SRV and MX,
22
- # :port => optional, required for SRV,
23
- # :weight => optional, required for SRV
24
- # }
25
- def self.create(domain_id, record_type, data, name = nil, priority = nil, port = nil, weight = nil)
26
- attrs = {
27
- domain_id: domain_id,
28
- record_type: record_type,
29
- data: data,
30
- name: name,
31
- priority: priority,
32
- port: port,
33
- weight: weight,
34
- }
35
- response = Digitalocean.request.get "domains/#{domain_id}/records/new", attrs
36
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
37
- end
38
-
39
- # attrs = {
40
- # :domain_id => domain_id || domain_name,
41
- # :record_type => 'A' || 'CNAME' || 'NS' || 'TXT' || 'MX' || 'SRV',
42
- # :data => '@' || '123.123.123.123' || ...,
43
- # :name => optional, required for A, CNAME, TXT, and SRV records,
44
- # :priority => optional, required for SRV and MX,
45
- # :port => optional, required for SRV,
46
- # :weight => optional, required for SRV
47
- # }
48
- def self.edit(domain_id, record_id, attrs)
49
- attrs.merge({
50
- domain_id: domain_id,
51
- record_id: record_id
52
- })
53
- response = Digitalocean.request.get "domains/#{domain_id}/records/#{record_id}/edit", attrs
54
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
55
- end
56
-
57
- def self.destroy(domain_id, record_id)
58
- response = Digitalocean.request.get "domains/#{domain_id}/records/#{record_id}/destroy"
59
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
60
- end
61
- end
62
- end
@@ -1,14 +0,0 @@
1
- module Digitalocean
2
- class Region
3
- #
4
- # Api calls
5
- #
6
- def self.all
7
- response = Digitalocean.request.get "regions"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
- def self.find(id)
11
- self.all.regions.detect{|region| region.id == id}
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module Digitalocean
2
- class Size
3
- #
4
- # Api calls
5
- #
6
- def self.all
7
- response = Digitalocean.request.get "sizes"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
- def self.find(id)
11
- self.all.sizes.detect{|size| size.id == id}
12
- end
13
- end
14
- end
@@ -1,21 +0,0 @@
1
- module Digitalocean
2
- class SshKey
3
- #
4
- # Api calls
5
- #
6
- def self.all
7
- response = Digitalocean.request.get "ssh_keys"
8
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
9
- end
10
-
11
- def self.retrieve(ssh_key_id=nil)
12
- response = Digitalocean.request.get "ssh_keys/#{ssh_key_id}"
13
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
14
- end
15
-
16
- def self.create(attrs)
17
- response = Digitalocean.request.get "ssh_keys/new", attrs
18
- RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
19
- end
20
- end
21
- end