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 +4 -4
- data/lib/hal_interpretation/version.rb +1 -1
- data/lib/hal_interpretation.rb +6 -0
- data/spec/hal_interpretation_spec.rb +4 -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: cea8a51625a140b91f33d23ff8cdce60d2748ebf
|
4
|
+
data.tar.gz: fbcd0ddd428b0114b9e1bf5b506fa6843c8fcda6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef35522580e2014518d56d1c7c5004d9724ccc026435c27a65fd06c1128ec4b162522c3daba84fc947ec4ddd58890775805203f584bec4b13f64dc5a254725b9
|
7
|
+
data.tar.gz: efbe0228c3e4b8dbb22ed2a05adf28f6c0d7a80632f7d8d395b658d6f823b3f77c2e124c8ce431d6be5f362f860b0577ac0189a3eca8dc009fc96f6b126cfd9f
|
data/lib/hal_interpretation.rb
CHANGED
@@ -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.
|
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:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hal-client
|