hal-client 3.17.0 → 3.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hal_client/link.rb +1 -0
- data/lib/hal_client/links_section.rb +1 -0
- data/lib/hal_client/representation.rb +1 -1
- data/lib/hal_client/version.rb +1 -1
- data/spec/hal_client/link_spec.rb +12 -0
- data/spec/hal_client/links_section_spec.rb +4 -0
- data/spec/hal_client/representation_spec.rb +2 -0
- 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: 5d2c194b53f031309d1fa2380dddfd3496543ae0
|
4
|
+
data.tar.gz: de974dcd0f45301ad37dda8122dac62a1321628f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0aba01ccd2098a6f324c6054645a8af63555ed468f12c428e4a9da09e9b4c48956c4006828869deda0083a513c531579a6d3c0dab9b9ce061f1c541b71dd060
|
7
|
+
data.tar.gz: b43cd1474e4121bb48eeda832b3c8cd54c2f4d5b1049510cb758298d410457f616715879b0f94d44cfc4474cfee3a360ac9d1fe6f9dec2f13705c67ad8097192
|
data/lib/hal_client/link.rb
CHANGED
@@ -367,7 +367,7 @@ class HalClient
|
|
367
367
|
default_proc ||= NO_LINK_FOUND
|
368
368
|
|
369
369
|
relations = links.hrefs(link_rel) { MISSING }
|
370
|
-
return default_proc.call(link_rel, options) if relations == MISSING
|
370
|
+
return default_proc.call(link_rel, options) if relations == MISSING || relations.compact.empty?
|
371
371
|
|
372
372
|
relations
|
373
373
|
.map {|url_or_tmpl|
|
data/lib/hal_client/version.rb
CHANGED
@@ -49,6 +49,18 @@ RSpec.describe HalClient::Link do
|
|
49
49
|
base_url: base_url)
|
50
50
|
expect(my_link.raw_href).to eq((base_url + relative_href_1).to_s)
|
51
51
|
end
|
52
|
+
|
53
|
+
it "handles hrefs with a nil value" do
|
54
|
+
input_hash = link_entry_hash(href: nil)
|
55
|
+
base_url = Addressable::URI.parse(href_1)
|
56
|
+
|
57
|
+
my_link = described_class.new_from_link_entry(hash_entry: input_hash,
|
58
|
+
hal_client: a_client,
|
59
|
+
curie_resolver: curie_resolver,
|
60
|
+
base_url: base_url)
|
61
|
+
|
62
|
+
expect(my_link.raw_href).to eq(base_url.to_s)
|
63
|
+
end
|
52
64
|
end
|
53
65
|
|
54
66
|
describe ".new_from_embedded_entry" do
|
@@ -30,6 +30,9 @@ RSpec.describe HalClient::LinksSection, "namespaces embedded" do
|
|
30
30
|
|
31
31
|
specify { expect{section.hrefs("nonexistent")}.to raise_error KeyError }
|
32
32
|
|
33
|
+
specify { expect(section.hrefs("nil_href"))
|
34
|
+
.to contain_exactly nil }
|
35
|
+
|
33
36
|
let(:fully_qualified_first_rel) { "http://rels.example.com/first" }
|
34
37
|
let(:fully_qualified_second_rel) { "http://rels.example.com/2/second" }
|
35
38
|
|
@@ -45,6 +48,7 @@ RSpec.describe HalClient::LinksSection, "namespaces embedded" do
|
|
45
48
|
"ns1:first" => {"href" => "http://example.com/foo"},
|
46
49
|
"ns2:second" => [{"href" => "http://example.com/bar"},
|
47
50
|
{"href" => "http://example.com/baz"}],
|
51
|
+
"nil_href" => {"href" => nil},
|
48
52
|
"next" => {"href" => "/foo?p=2"}
|
49
53
|
} }
|
50
54
|
|
@@ -11,6 +11,7 @@ RSpec.describe HalClient::Representation do
|
|
11
11
|
,"templated": true }
|
12
12
|
,"link3": [{ "href": "http://example.com/link3-a" }
|
13
13
|
,{ "href": "http://example.com/link3-b" }]
|
14
|
+
,"nil_link": { "href": null }
|
14
15
|
,"dup": { "href": "http://example.com/dup" }
|
15
16
|
}
|
16
17
|
,"_embedded": {
|
@@ -301,6 +302,7 @@ HAL
|
|
301
302
|
|
302
303
|
specify { expect(subject.has_related? "no-such-link-or-embed").to be false }
|
303
304
|
specify { expect(subject.related? "no-such-link-or-embed").to be false }
|
305
|
+
specify { expect(subject.related? "nil_link").to be false }
|
304
306
|
|
305
307
|
specify { expect(subject.to_json).to be_equivalent_json_to raw_repr }
|
306
308
|
specify { expect(subject.to_hal).to be_equivalent_json_to raw_repr }
|
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.17.
|
4
|
+
version: 3.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|