hal-client 3.2.2 → 3.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/hal_client/representation.rb +4 -0
- data/lib/hal_client/version.rb +1 -1
- data/spec/hal_client/representation_spec.rb +25 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 454803feafd3de62522b145857cf25b91bceea18
|
4
|
+
data.tar.gz: 279121c58f7ebc9456d2b8575a342d9069346883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4591e0f1bbfc67522893bf2e79781d40ad765030e8cefb9a3bdfddf9d5c1146107ffbdc8dbb401914a0abf3404b0ab75aacc64f35a15996c5b1fc558fb732f9
|
7
|
+
data.tar.gz: 1a12ff06dea5247600ddd62b8799b0e00f130b07088aee4de2f5d3507dd48bf9173d72b0b79f2f9ab6f5fdec307f241e7a33647e471791c9dec84a5c5693955c
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
![Build Status](https://travis-ci.org/pezra/hal-client.png?branch=master)](https://travis-ci.org/pezra/hal-client)
|
2
2
|
[![Code Climate](https://codeclimate.com/github/pezra/hal-client.png)](https://codeclimate.com/github/pezra/hal-client)
|
3
3
|
|
4
4
|
# HalClient
|
@@ -78,7 +78,7 @@ All `HalClient::Representation`s exposed an `#href` attribute which is its ident
|
|
78
78
|
|
79
79
|
HalClient provides a high level abstraction for paged collections encoded using [standard `item`, `next` and `prev` link relations](http://tools.ietf.org/html/rfc6573).
|
80
80
|
|
81
|
-
articles =
|
81
|
+
articles = blog.as_enum
|
82
82
|
articles.each do |an_article|
|
83
83
|
# do something with each article representation
|
84
84
|
end
|
data/lib/hal_client/version.rb
CHANGED
@@ -215,7 +215,6 @@ HAL
|
|
215
215
|
specify { expect(subject.to_json).to be_equivalent_json_to raw_repr }
|
216
216
|
specify { expect(subject.to_hal).to be_equivalent_json_to raw_repr }
|
217
217
|
|
218
|
-
|
219
218
|
context "curie links" do
|
220
219
|
let(:raw_repr) { <<-HAL }
|
221
220
|
{ "_links": {
|
@@ -291,6 +290,31 @@ HAL
|
|
291
290
|
.to raise_error HalClient::InvalidRepresentationError, %r(/_embedded/array-of-atoms) }
|
292
291
|
|
293
292
|
end
|
293
|
+
|
294
|
+
specify { expect(repr).to respond_to :as_enum }
|
295
|
+
|
296
|
+
context "collection" do
|
297
|
+
let(:raw_repr) { <<-HAL }
|
298
|
+
{ "_links": {
|
299
|
+
"self": { "href": "http://example.com/foo" }
|
300
|
+
}
|
301
|
+
,"_embedded": {
|
302
|
+
"item": [
|
303
|
+
{"name": "first"}
|
304
|
+
,{"name": "second"}
|
305
|
+
]
|
306
|
+
}
|
307
|
+
}
|
308
|
+
HAL
|
309
|
+
|
310
|
+
specify { expect(repr.as_enum).to a_kind_of Enumerable }
|
311
|
+
specify { expect(repr.as_enum).to have(2).items }
|
312
|
+
end
|
313
|
+
|
314
|
+
context "non-collection" do
|
315
|
+
specify { expect{repr.as_enum}.to raise_error }
|
316
|
+
end
|
317
|
+
|
294
318
|
# Background
|
295
319
|
|
296
320
|
let(:a_client) { HalClient.new }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hal-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|