lhs 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lhs/collection.rb +6 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/record/new_spec.rb +19 -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: 3487e37bda58a0a1b774e11778cb239f16489c95
|
4
|
+
data.tar.gz: 702c8edef48c3971724878e0eff8416b36dac3db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 035800d35582128787be14d1dcc58cd43e1fe7fece5165f3ec84c63dc41bc0f295ac5423f282f3f747e98479ef88e7c7e3bf59e09a9e9408f1090078a688e953
|
7
|
+
data.tar.gz: 815442c0a04adff1b361a9f5015cb02f8d7e749ef879cf4e4245bfd1d4fe479bf6048b59a83122fd93d4faf87799a093d9d18310353a2de5eda161aeedb90ce9
|
data/lib/lhs/collection.rb
CHANGED
@@ -27,7 +27,7 @@ class LHS::Collection < LHS::Proxy
|
|
27
27
|
|
28
28
|
def _collection
|
29
29
|
raw = _data._raw if _data._raw.is_a?(Array)
|
30
|
-
raw ||= _data._raw[
|
30
|
+
raw ||= _data._raw[items_key]
|
31
31
|
Collection.new(raw, _data, _record)
|
32
32
|
end
|
33
33
|
|
@@ -47,6 +47,11 @@ class LHS::Collection < LHS::Proxy
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
+
def items_key
|
51
|
+
return _record.items_key if _record
|
52
|
+
:items
|
53
|
+
end
|
54
|
+
|
50
55
|
def enclose_in_data(value)
|
51
56
|
data = LHS::Data.new(value, _data)
|
52
57
|
item = LHS::Item.new(data)
|
data/lib/lhs/version.rb
CHANGED
data/spec/record/new_spec.rb
CHANGED
@@ -26,6 +26,25 @@ describe LHS::Record do
|
|
26
26
|
expect(feedback._raw[:'some-key']).to eq([])
|
27
27
|
end
|
28
28
|
|
29
|
+
context 'initialise records with raw data' do
|
30
|
+
before(:each) do
|
31
|
+
class User < LHS::Record
|
32
|
+
endpoint ':datastore/users'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'allows accessing nested data' do
|
37
|
+
user = User.new({
|
38
|
+
claims: {
|
39
|
+
items: [
|
40
|
+
{ method: 'CustomerCenter' }
|
41
|
+
]
|
42
|
+
}
|
43
|
+
}.to_json)
|
44
|
+
expect(user.claims.first['method']).to eq 'CustomerCenter'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
29
48
|
context 'custom setters' do
|
30
49
|
before(:each) do
|
31
50
|
class Feedback
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|