resource_kit 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/examples/digitalocean_droplets.rb +7 -0
- data/lib/resource_kit/action_invoker.rb +1 -1
- data/lib/resource_kit/version.rb +1 -1
- data/spec/lib/resource_kit/action_invoker_spec.rb +11 -0
- metadata +24 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee27d303775af18adad2dafcfcaef1d1af3788ba
|
4
|
+
data.tar.gz: 3bc5c1aa4352638e03f2cb775dd34465d822fef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eeb8ed53484b56feeb69fecda64b3083348d38c0b1051dc23b053bb0c162cd8da70da06547a20b8e1131ba02ddeef66b299720444685163f33b040a259537aa
|
7
|
+
data.tar.gz: f9946fc5aefe0becad0403664b5a0099a4da88f8736d79ea6959c045558006eaf8b1c9b535d448a05b8958ef7af57102d5ceff36e4920e40999550f3e6c903f2
|
data/.travis.yml
ADDED
@@ -39,6 +39,13 @@ class DropletResource < ResourceKit::Resource
|
|
39
39
|
body { |object| DropletMapping.representation_for(:create, object) }
|
40
40
|
handler(202) { |response| DropletMapping.extract_single(response.body, :read) }
|
41
41
|
end
|
42
|
+
|
43
|
+
action :update do
|
44
|
+
verb :put
|
45
|
+
path '/v2/droplets/123'
|
46
|
+
body { |object| DropletMapping.representation_for(:create, object) }
|
47
|
+
handler(200) { |response, object| DropletMapping.extract_into_object(object, response.body, :read) }
|
48
|
+
end
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
@@ -16,7 +16,7 @@ module ResourceKit
|
|
16
16
|
|
17
17
|
def handle_response
|
18
18
|
if handler = action.handlers[response.status] || action.handlers[:any]
|
19
|
-
resource.instance_exec(response, &handler)
|
19
|
+
resource.instance_exec(response, *args, &handler) # Since the handler is a block, it does not enforce parameter length checking
|
20
20
|
else
|
21
21
|
response.body
|
22
22
|
end
|
data/lib/resource_kit/version.rb
CHANGED
@@ -52,6 +52,17 @@ RSpec.describe ResourceKit::ActionInvoker do
|
|
52
52
|
expect(result).to eq('changed')
|
53
53
|
end
|
54
54
|
|
55
|
+
it 'passes the initial object' do
|
56
|
+
action.verb :get
|
57
|
+
action.path '/users'
|
58
|
+
action.handler(200) { |response, hash| hash }
|
59
|
+
|
60
|
+
target_hash = Hash.new
|
61
|
+
result = ResourceKit::ActionInvoker.call(action, resource, target_hash)
|
62
|
+
|
63
|
+
expect(result).to be target_hash
|
64
|
+
end
|
65
|
+
|
55
66
|
it 'uses the correct handler on status codes' do
|
56
67
|
action.verb :get
|
57
68
|
action.path '/users/bad_page'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resource_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Ross
|
@@ -9,118 +9,118 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.3.6
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.3.6
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.6'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.6'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: faraday
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '3.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '3.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: webmock
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ~>
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 1.18.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 1.18.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: kartograph
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ~>
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: 0.0.8
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ~>
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 0.0.8
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: pry
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ~>
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: 0.10.1
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 0.10.1
|
126
126
|
description: ''
|
@@ -132,8 +132,9 @@ executables: []
|
|
132
132
|
extensions: []
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
|
-
-
|
136
|
-
-
|
135
|
+
- .gitignore
|
136
|
+
- .rspec
|
137
|
+
- .travis.yml
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE.txt
|
139
140
|
- README.md
|
@@ -176,17 +177,17 @@ require_paths:
|
|
176
177
|
- lib
|
177
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
178
179
|
requirements:
|
179
|
-
- -
|
180
|
+
- - '>='
|
180
181
|
- !ruby/object:Gem::Version
|
181
182
|
version: '2.0'
|
182
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
184
|
requirements:
|
184
|
-
- -
|
185
|
+
- - '>='
|
185
186
|
- !ruby/object:Gem::Version
|
186
187
|
version: '0'
|
187
188
|
requirements: []
|
188
189
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.0.14
|
190
191
|
signing_key:
|
191
192
|
specification_version: 4
|
192
193
|
summary: Resource Kit provides tools to aid in making API Clients. Such as URL resolving,
|