droplet_kit 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e43efb48656febf1baf2550b520d7c0c2a7b39d2
4
- data.tar.gz: 1e5a17558dd524315f33b1ce62f525d5d6bd7564
3
+ metadata.gz: 185afe4b52d8be9e2ba11954571b30bd353be23a
4
+ data.tar.gz: b6190c66187a345d8e2ac3202ce4c6bc7c12e1bb
5
5
  SHA512:
6
- metadata.gz: 5ea1044a5bfdb6c3a778a23f5c16410a13b51772ea0071de14e786a3661d684d8115934f71ccfbdd1b59f479e01e10cf0acf94f0eead04b5d0397d7b11508267
7
- data.tar.gz: 460b7344ce21709ea9e6af3353d529b7620e61c0f1dda18ca04d10a2bcb3de69fb2804b0baf122d1700bc0e64337fec7e3abc0e3d4cb972c6bf75a0627848529
6
+ metadata.gz: b8ee683a95cddc0aa7e27d12c8998f8261239c1c33dc1ae3056ede3b4507ec6af701201318e70f44d1aae675aa24427444de4ece9d5ba0a1c7aec290d6cc5e45
7
+ data.tar.gz: 806536b844957cac6131f9bf1c5e41320eb89067dee19459d44f9d5ea48c8122f28a9c38751d7ef19cdf6ff50607d236b6e4111041dcc94ee16205ba3604a816
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- You'll need to generate an access token in Digital Oceans control panel at https://cloud.digitalocean.com/settings/applications
21
+ You'll need to generate an access token in Digital Ocean's control panel at https://cloud.digitalocean.com/settings/applications
22
22
 
23
23
  With your access token, retrieve a client instance with it.
24
24
 
@@ -60,6 +60,97 @@ droplet = client.droplets.find(id: 123)
60
60
  # => DropletKit::Droplet(id: 1231, name: 'something.com', ...)
61
61
  ```
62
62
 
63
+ # All Resources and actions.
64
+ ## Droplet resource
65
+
66
+ client = DropletKit::Client.new(access_token: 'TOKEN')
67
+ client.droplets #=> DropletKit::DropletResource
68
+
69
+ Actions supported:
70
+
71
+ * `client.droplets.all()`
72
+ * `client.droplets.find(id: 'id')`
73
+ * `client.droplets.create(droplet)`
74
+ * `client.droplets.delete(id: 'id')`
75
+ * `client.droplets.kernels(id: 'id')`
76
+ * `client.droplets.snapshots(id: 'id')`
77
+ * `client.droplets.backups(id: 'id')`
78
+ * `client.droplets.actions(id: 'id')`
79
+
80
+
81
+ ## Domain resource
82
+
83
+ client = DropletKit::Client.new(access_token: 'TOKEN')
84
+ client.domains #=> DropletKit::DomainResource
85
+
86
+ Actions supported:
87
+
88
+ * `client.domains.all()`
89
+ * `client.domains.create(domain)`
90
+ * `client.domains.find(name: 'name')`
91
+ * `client.domains.delete(name: 'name')`
92
+
93
+
94
+ ## Domain record resource
95
+
96
+ client = DropletKit::Client.new(access_token: 'TOKEN')
97
+ client.domain_records #=> DropletKit::DomainRecordResource
98
+
99
+ Actions supported:
100
+
101
+ * `client.domain_records.all(for_domain: 'for_domain')`
102
+ * `client.domain_records.create(domain_record, for_domain: 'for_domain')`
103
+ * `client.domain_records.find(for_domain: 'for_domain', id: 'id')`
104
+ * `client.domain_records.delete(for_domain: 'for_domain', id: 'id')`
105
+ * `client.domain_records.update(domain_record, for_domain: 'for_domain', id: 'id')`
106
+
107
+
108
+ ## Image resource
109
+
110
+ client = DropletKit::Client.new(access_token: 'TOKEN')
111
+ client.images #=> DropletKit::ImageResource
112
+
113
+ Actions supported:
114
+
115
+ * `client.images.all()`
116
+ * `client.images.find(id: 'id')`
117
+ * `client.images.delete(id: 'id')`
118
+ * `client.images.update(image, id: 'id')`
119
+
120
+
121
+ ## Region resource
122
+
123
+ client = DropletKit::Client.new(access_token: 'TOKEN')
124
+ client.regions #=> DropletKit::RegionResource
125
+
126
+ Actions supported:
127
+
128
+ * `client.regions.all()`
129
+
130
+
131
+ ## Size resource
132
+
133
+ client = DropletKit::Client.new(access_token: 'TOKEN')
134
+ client.sizes #=> DropletKit::SizeResource
135
+
136
+ Actions supported:
137
+
138
+ * `client.sizes.all()`
139
+
140
+
141
+ ## Ssh key resource
142
+
143
+ client = DropletKit::Client.new(access_token: 'TOKEN')
144
+ client.ssh_keys #=> DropletKit::SSHKeyResource
145
+
146
+ Actions supported:
147
+
148
+ * `client.ssh_keys.all()`
149
+ * `client.ssh_keys.create(ssh_key)`
150
+ * `client.ssh_keys.find(id: 'id')`
151
+ * `client.ssh_keys.delete(id: 'id')`
152
+ * `client.ssh_keys.update(ssh_key, id: 'id')`
153
+
63
154
 
64
155
  ## Contributing
65
156
 
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ load './lib/tasks/resource_doc.rake'
4
+
@@ -1,4 +1,3 @@
1
1
  module DropletKit
2
- class Network < Struct.new(:ip_address, :netmask, :gateway, :type, :cidr)
3
- end
4
- end
2
+ Network = Struct.new(:ip_address, :netmask, :gateway, :type, :cidr)
3
+ end
@@ -1,4 +1,3 @@
1
1
  module DropletKit
2
- class NetworkHash < Struct.new(:v4, :v6)
3
- end
4
- end
2
+ NetworkHash = Struct.new(:v4, :v6)
3
+ end
@@ -2,6 +2,7 @@ module DropletKit
2
2
  class ImageResource < ResourceKit::Resource
3
3
  resources do
4
4
  action :all, 'GET /v2/images' do
5
+ query_keys :page, :per_page
5
6
  handler(200) { |response| ImageMapping.extract_collection(response.body, :read) }
6
7
  end
7
8
 
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -0,0 +1,42 @@
1
+ require 'droplet_kit'
2
+
3
+ namespace :doc do
4
+ task :resources do
5
+ resources = DropletKit::Client.resources
6
+
7
+ resources.each do |key, klass|
8
+ if klass.name.in?((ENV['SKIP_CLASSES'] || '').split(','))
9
+ next
10
+ end
11
+
12
+ puts "## #{klass.name.demodulize.underscore.humanize}"
13
+ puts
14
+ puts " client = DropletKit::Client.new(access_token: 'TOKEN')"
15
+ puts " client.#{key} #=> #{klass.name}"
16
+ puts
17
+ puts "Actions supported: "
18
+ puts
19
+ klass._resources.each do |action|
20
+ action_options = action.path.scan(/\:[\w_\-]+/i)
21
+ params = []
22
+
23
+ if action.body && action.body.arity > 0
24
+ params << klass.name.demodulize.underscore.downcase.gsub('_resource', '')
25
+ end
26
+
27
+ if action_options.any?
28
+ action_string = action_options.map do |option|
29
+ option.gsub!(/^\:/, '')
30
+ "#{option}: '#{option}'"
31
+ end.join(', ')
32
+
33
+ params << action_string
34
+ end
35
+
36
+ puts "* `client.#{key}.#{action.name}(#{params.join(', ')})`"
37
+ end
38
+ puts
39
+ puts
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droplet_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: resource_kit
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.0.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.0.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: kartograph
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.0.5
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.0.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sinatra
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.4'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '1.18'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.18'
139
139
  description: Droplet Kit is the official Ruby library for Digital Ocean's API
@@ -143,8 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - .gitignore
147
- - .rspec
146
+ - ".gitignore"
147
+ - ".rspec"
148
148
  - Gemfile
149
149
  - LICENSE.txt
150
150
  - README.md
@@ -196,6 +196,7 @@ files:
196
196
  - lib/droplet_kit/resources/size_resource.rb
197
197
  - lib/droplet_kit/resources/ssh_key_resource.rb
198
198
  - lib/droplet_kit/version.rb
199
+ - lib/tasks/resource_doc.rake
199
200
  - spec/fixtures/actions/all.json
200
201
  - spec/fixtures/actions/find.json
201
202
  - spec/fixtures/domain_records/all.json
@@ -249,12 +250,12 @@ require_paths:
249
250
  - lib
250
251
  required_ruby_version: !ruby/object:Gem::Requirement
251
252
  requirements:
252
- - - '>='
253
+ - - ">="
253
254
  - !ruby/object:Gem::Version
254
255
  version: '0'
255
256
  required_rubygems_version: !ruby/object:Gem::Requirement
256
257
  requirements:
257
- - - '>='
258
+ - - ">="
258
259
  - !ruby/object:Gem::Version
259
260
  version: '0'
260
261
  requirements: []