hal-interpretation 1.5.0 → 1.6.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: ba7860074fdcec96c7e93e4de881bc2acbf2654f
4
- data.tar.gz: 99d106bfe6ec85f33979309d5c4983e21fd450ff
3
+ metadata.gz: cea8a51625a140b91f33d23ff8cdce60d2748ebf
4
+ data.tar.gz: fbcd0ddd428b0114b9e1bf5b506fa6843c8fcda6
5
5
  SHA512:
6
- metadata.gz: d550101e729d0997a634ca46e9141d19d8cd9023c3b9c156172205e764031674ab235ecb2061ab78d90e403b36b9b3d7e6984d51f09b956bc8d5a219441a5eb4
7
- data.tar.gz: b1e21c3e017494d6532adf460fea15edb442d4dbab9f2c55c07689b379ac8bc51785b88bf123e9d9a268a5f5a69b7546d94607a8f8dc09c50b9f94ecce0e7b47
6
+ metadata.gz: ef35522580e2014518d56d1c7c5004d9724ccc026435c27a65fd06c1128ec4b162522c3daba84fc947ec4ddd58890775805203f584bec4b13f64dc5a254725b9
7
+ data.tar.gz: efbe0228c3e4b8dbb22ed2a05adf28f6c0d7a80632f7d8d395b658d6f823b3f77c2e124c8ce431d6be5f362f860b0577ac0189a3eca8dc009fc96f6b126cfd9f
@@ -1,3 +1,3 @@
1
1
  module HalInterpretation
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -41,6 +41,12 @@ module HalInterpretation
41
41
  @problems ||= interpreters.flat_map(&:problems)
42
42
  end
43
43
 
44
+ # returns true if the json interpreted was a collection (had
45
+ # embedded items) even if there was only one; otherwise false
46
+ def collection?
47
+ repr.has_related?("item")
48
+ end
49
+
44
50
  extend Forwardable
45
51
  def_delegators "self.class", :extractors, :extractor_for
46
52
 
@@ -59,6 +59,8 @@ describe HalInterpretation do
59
59
 
60
60
  specify { expect(interpreter.problems).to be_empty }
61
61
 
62
+ specify { expect(interpreter.collection?).to be false }
63
+
62
64
  context "for update" do
63
65
  let(:existing) { test_item_class.new do |it|
64
66
  it.name = "foo"
@@ -128,6 +130,8 @@ describe HalInterpretation do
128
130
  specify { expect{interpreter.item}
129
131
  .to raise_error HalInterpretation::InvalidRepresentationError }
130
132
 
133
+ specify { expect(interpreter.collection?).to be true }
134
+
131
135
  matcher :item_named do |expected_name|
132
136
  match do |obj|
133
137
  obj.name == expected_name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal-interpretation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
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-12-22 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hal-client