hyperclient 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -2
- data/CHANGELOG.md +2 -1
- data/README.md +3 -2
- data/examples/splines_api.rb +4 -2
- data/features/api_navigation.feature +1 -0
- data/features/steps/api_navigation.rb +9 -0
- data/lib/hyperclient/resource.rb +1 -1
- data/lib/hyperclient/version.rb +1 -1
- metadata +35 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2daa0c1ea450238670cb824e5d1d7dd07a5b956
|
4
|
+
data.tar.gz: 2a70fee311b942248162d688afd7f1c301eb4b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4090176fce80ffdeb57dca157f28896e261aa77e35ff863f992ee566248c71ba78820138b0b5f010e867865073d6044b8a151bda612f1a8f722fa217c02ee69c
|
7
|
+
data.tar.gz: ac16dcb963df0b148761d94b4d9cc0cca1ff60334449a3d172d8bb972550cf80ad8aef0bd2dcb58e7a12c89916769dcd35daa8ae8d84c79a3d9fec36296675c5
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2016-03-15 15:48:04 -0400 using RuboCop version 0.33.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -16,7 +16,7 @@ Metrics/ClassLength:
|
|
16
16
|
Metrics/LineLength:
|
17
17
|
Max: 142
|
18
18
|
|
19
|
-
# Offense count:
|
19
|
+
# Offense count: 3
|
20
20
|
# Configuration parameters: CountComments.
|
21
21
|
Metrics/MethodLength:
|
22
22
|
Max: 25
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
### 0.8.
|
1
|
+
### 0.8.1 (MArch 15, 2016)
|
2
2
|
|
3
3
|
* [#97](https://github.com/codegram/hyperclient/issues/97): Fix: curies are no longer used as link shorteners - [@joshco](https://github.com/joshco), [@dblock](https://github.com/dblock).
|
4
|
+
* [#95](https://github.com/codegram/hyperclient/issues/95): Fix: re-add eager delegation for `resource.each` - [@dblock](https://github.com/dblock).
|
4
5
|
|
5
6
|
### 0.7.2 (August 23, 2015)
|
6
7
|
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Hyperclient is a Hypermedia API client written in Ruby. It fully supports [JSON
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
-
The examples in this README use the [Splines Demo API](https://github.com/
|
13
|
+
The examples in this README use the [Splines Demo API](https://github.com/ruby-grape/grape-with-roar) running [here](https://grape-with-roar.herokuapp.com/api). If you're upgrading from a previous version, please make sure to read [UPGRADING](UPGRADING.md).
|
14
14
|
|
15
15
|
### API Client
|
16
16
|
|
@@ -199,6 +199,7 @@ describe Acme::Api do
|
|
199
199
|
|
200
200
|
let(:client) do
|
201
201
|
Hyperclient.new('http://example.org/api') do |client|
|
202
|
+
client.headers['Content-Type'] = 'application/json'
|
202
203
|
client.connection(default: false) do |conn|
|
203
204
|
conn.request :json
|
204
205
|
conn.response :json
|
@@ -213,7 +214,7 @@ describe Acme::Api do
|
|
213
214
|
end
|
214
215
|
```
|
215
216
|
|
216
|
-
For a complete example refer to [this Splines Demo API test](https://github.com/
|
217
|
+
For a complete example refer to [this Splines Demo API test](https://github.com/ruby-grape/grape-with-roar/blob/master/spec/api/splines_endpoint_with_hyperclient_spec.rb).
|
217
218
|
|
218
219
|
## Reference
|
219
220
|
|
data/examples/splines_api.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'hyperclient'
|
2
2
|
|
3
|
+
puts "Using Hyperclient #{Hyperclient::VERSION} ..."
|
4
|
+
|
3
5
|
# create a new client
|
4
6
|
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api')
|
5
7
|
|
@@ -25,11 +27,11 @@ puts "Spline #{spline.uuid} is #{spline.reticulated ? 'reticulated' : 'not retic
|
|
25
27
|
# spline.to_h
|
26
28
|
|
27
29
|
# create a new spline
|
28
|
-
spline = api.splines._post(reticulated: true)
|
30
|
+
spline = api.splines._post(spline: { reticulated: true })
|
29
31
|
puts "Created a #{spline.reticulated ? 'reticulated' : 'unreticulated'} spline #{spline.uuid}."
|
30
32
|
|
31
33
|
# update an existing spline
|
32
|
-
spline = api.spline(uuid: 123)._put(reticulated: true)
|
34
|
+
spline = api.spline(uuid: 123)._put(spline: { reticulated: true })
|
33
35
|
puts "Updated spline #{spline.uuid}, now #{spline.reticulated ? 'reticulated' : 'not reticulated'}."
|
34
36
|
|
35
37
|
# delete an existing spline
|
@@ -43,5 +43,14 @@ class Spinach::Features::ApiNavigation < Spinach::FeatureSteps
|
|
43
43
|
assert_equal 2, api._links.posts._resource._embedded.posts.count
|
44
44
|
assert_equal 2, api.posts._embedded.posts.count
|
45
45
|
assert_equal 2, api.posts.count
|
46
|
+
assert_equal 2, api.posts.map.count
|
47
|
+
end
|
48
|
+
|
49
|
+
step 'I should be able to iterate over embedded items' do
|
50
|
+
count = 0
|
51
|
+
api.posts.each do |_post|
|
52
|
+
count += 1
|
53
|
+
end
|
54
|
+
assert_equal 2, count
|
46
55
|
end
|
47
56
|
end
|
data/lib/hyperclient/resource.rb
CHANGED
@@ -84,7 +84,7 @@ module Hyperclient
|
|
84
84
|
def method_missing(method, *args, &block)
|
85
85
|
if args.any? && args.first.is_a?(Hash)
|
86
86
|
_links.send(method, [], &block)._expand(*args)
|
87
|
-
elsif !
|
87
|
+
elsif !Array.method_defined?(method)
|
88
88
|
[:_attributes, :_embedded, :_links].each do |target|
|
89
89
|
target = send(target)
|
90
90
|
return target.send(method, *args, &block) if target.respond_to?(method.to_s)
|
data/lib/hyperclient/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oriol Gual
|
@@ -14,182 +14,182 @@ dependencies:
|
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
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: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: futuroscope
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
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'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday_middleware
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
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'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday_hal_middleware
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
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: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: uri_template
|
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: :runtime
|
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: net-http-digest_auth
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
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: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: faraday-digestauth
|
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: :runtime
|
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: minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
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: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: turn
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
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: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: webmock
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: mocha
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rack-test
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: spinach
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
description: HyperClient is a Ruby Hypermedia API client.
|
@@ -199,11 +199,11 @@ executables: []
|
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
- .gitignore
|
203
|
-
- .rubocop.yml
|
204
|
-
- .rubocop_todo.yml
|
205
|
-
- .travis.yml
|
206
|
-
- .yardopts
|
202
|
+
- ".gitignore"
|
203
|
+
- ".rubocop.yml"
|
204
|
+
- ".rubocop_todo.yml"
|
205
|
+
- ".travis.yml"
|
206
|
+
- ".yardopts"
|
207
207
|
- CHANGELOG.md
|
208
208
|
- CONTRIBUTING.md
|
209
209
|
- Gemfile
|
@@ -256,17 +256,17 @@ require_paths:
|
|
256
256
|
- lib
|
257
257
|
required_ruby_version: !ruby/object:Gem::Requirement
|
258
258
|
requirements:
|
259
|
-
- -
|
259
|
+
- - ">="
|
260
260
|
- !ruby/object:Gem::Version
|
261
261
|
version: '0'
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
|
-
- -
|
264
|
+
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.4.
|
269
|
+
rubygems_version: 2.4.6
|
270
270
|
signing_key:
|
271
271
|
specification_version: 4
|
272
272
|
summary: ''
|