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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad5fddbc81ea541b51fe1b5307b773b0f4877637
4
- data.tar.gz: 345b34a867ed7e0305aa7b36f9bc13b5f907a12b
3
+ metadata.gz: 3487e37bda58a0a1b774e11778cb239f16489c95
4
+ data.tar.gz: 702c8edef48c3971724878e0eff8416b36dac3db
5
5
  SHA512:
6
- metadata.gz: 57179b85e99d847699e2683ce84d145451a0e867764f7735815afe9ca89defec1434f2691e8c6be61aa763d07e45ffdf20f8f24e5a082a3cb1607dbdc3f8b08b
7
- data.tar.gz: 266ede9c1a9574ab6770865635872cb68df27eefaf3fb85e9f16988cde7ef64b8889e9e8cfac2d7125e2c4ee0ee43334b8049f5a5d18e86a59cef1b96e79b95b
6
+ metadata.gz: 035800d35582128787be14d1dcc58cd43e1fe7fece5165f3ec84c63dc41bc0f295ac5423f282f3f747e98479ef88e7c7e3bf59e09a9e9408f1090078a688e953
7
+ data.tar.gz: 815442c0a04adff1b361a9f5015cb02f8d7e749ef879cf4e4245bfd1d4fe479bf6048b59a83122fd93d4faf87799a093d9d18310353a2de5eda161aeedb90ce9
@@ -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[_record.items_key]
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)
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = "3.4.1"
2
+ VERSION = "3.4.2"
3
3
  end
@@ -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.1
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-03-10 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lhc