hal-client 1.4.0 → 1.5.0

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: b2ff485e8014f90b3dff0a1dfce149d179dd9cd1
4
- data.tar.gz: 52d3c6654272fbca9b80e69c4506182c524a1f46
3
+ metadata.gz: 035b9a77a60897b009604c5b84b767f6870e9da7
4
+ data.tar.gz: 453668c1af155925f62572cfb8988b79cf9f302c
5
5
  SHA512:
6
- metadata.gz: 5ab224fd14a959818ce357dc71926fee813f90cc1f583d94c547e0842fabffad307021f285924d9193056b29e3a2b2670f89e55b56626688fbe488a9fc2edbd5
7
- data.tar.gz: 31932812f8c8472d4dfd55515e8781c3407627709daf6ce6a25a01c0d5a1064069986bc428c64bfeb85e54addc73911215e15d7035976f7b1da384c0be710f36
6
+ metadata.gz: 39f9c20f48fdf12774fa26ed087dd6a725d3c555b0d3f6741c5e23f65237f98414fea058c0113309105d017065edc257e28cebf88542acc1706e764160ebff1e
7
+ data.tar.gz: 0a2b994966d7427b4167934ca553264ce1a008d4a63b7385cc23d0f50340a52e7b32a035a39aa082ba0c05a0cb27dc7405c0ee3c1f79ce0eedf2e0d639489d72
@@ -111,10 +111,21 @@ class HalClient
111
111
  fetch(item_key, nil)
112
112
  end
113
113
 
114
+ # Returns true if this representation contains a link (including
115
+ # embedded links) whose rel is `link_rel`.
116
+ #
117
+ # link_rel - The link rel of interest
118
+ def has_related?(link_rel)
119
+ _ = related link_rel
120
+ true
121
+ rescue KeyError
122
+ false
123
+ end
124
+
114
125
  # Returns representations of resources related via the specified
115
126
  # link rel or the specified default value.
116
127
  #
117
- # name_or_rel - The name of property or link rel of interest
128
+ # link_rel - The link rel of interest
118
129
  # options - optional keys and values with which to expand any
119
130
  # templated links that are encountered
120
131
  # default_proc - an option proc that will be called with `name`
@@ -141,7 +152,7 @@ class HalClient
141
152
  # Returns urls of resources related via the specified
142
153
  # link rel or the specified default value.
143
154
  #
144
- # name_or_rel - The name of property or link rel of interest
155
+ # link_rel - The link rel of interest
145
156
  # options - optional keys and values with which to expand any
146
157
  # templated links that are encountered
147
158
  # default_proc - an option proc that will be called with `name`
@@ -1,3 +1,3 @@
1
1
  class HalClient
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -152,6 +152,11 @@ HAL
152
152
  end
153
153
  end
154
154
 
155
+ specify { expect(subject.has_related? "link1").to be true }
156
+ specify { expect(subject.has_related? "embed1").to be true }
157
+
158
+ specify { expect(subject.has_related? "no-such-link").to be false }
159
+ specify { expect(subject.has_related? "no-such-embed").to be false }
155
160
 
156
161
  context "curie links" do
157
162
  let(:raw_repr) { <<-HAL }
@@ -209,6 +214,7 @@ HAL
209
214
 
210
215
 
211
216
 
217
+
212
218
  let(:a_client) { HalClient.new }
213
219
  let!(:bar_request) { stub_identity_request("http://example.com/bar") }
214
220
  let!(:baz_request) { stub_identity_request "http://example.com/baz" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams