lhs 15.0.2 → 15.1.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: 0e401b46b1033f255793a10a976ba7a0b14ec364
4
- data.tar.gz: b3e461f0882936419e352349caa0dcca4c5ec48c
3
+ metadata.gz: dc82efba3ea225c25ce9a6ae38a8664fd35a1cae
4
+ data.tar.gz: 791d7413db7537cb712d7a23fb2ce4d9a90c608b
5
5
  SHA512:
6
- metadata.gz: bbd204a60d46660fdcfb7ec01b71ef9e1e11a7ddf94827a4312e3b3235ecfaa96fdd87046d732a61a43f49b64b6601787e6f857b6dd8e0e39bbc5d4c006ab653
7
- data.tar.gz: 631a0a7a45c359da9e8c0f47f583a03f0950dc8263629d217c443feb77e92e37711fa526f52594f5189caa596c3031e0528411983b3afcbd1eedb960595caadc
6
+ metadata.gz: da53320bcf2cf2876edc9690a6bb54e64e4fdfcd1cbc9469d95bc2570e665db3efa1ff9880a3e3c68e53e73ef4ae17021c91109a96cd695ac0cc9a007920e44c
7
+ data.tar.gz: 1893d9468fb8974fe7a14fccc02021d2066d03726e314c697fa6314343b6ab7073c603eb9b68cc8597b86dd328374b778441945c8f9c4de1a06f42a4afd91da4
@@ -18,8 +18,13 @@ class LHS::Record
18
18
  else
19
19
  find_by_id(args, options)
20
20
  end
21
- return data if data && (data.is_a?(Array) || !data._record || data.collection?)
22
- data ? data._record.new(data.unwrap_nested_item) : nil
21
+ return nil if data.nil?
22
+ return data if !data._record
23
+ if data.collection?
24
+ data.map { |record| data._record.new(record.unwrap_nested_item) }
25
+ else
26
+ data._record.new(data.unwrap_nested_item)
27
+ end
23
28
  end
24
29
 
25
30
  private
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = '15.0.2'
2
+ VERSION = '15.1.0'
3
3
  end
@@ -36,4 +36,30 @@ describe LHS::Record do
36
36
  expect(data[1].name).to eq 'unknown'
37
37
  end
38
38
  end
39
+
40
+ context 'find in parallel with extra methods' do
41
+ before do
42
+ class Record < LHS::Record
43
+ endpoint 'http://datastore/records/{id}'
44
+
45
+ def identifier
46
+ 123456
47
+ end
48
+ end
49
+
50
+ stub_request(:get, "http://datastore/records/1").to_return(status: 200, body: { id: 1 }.to_json)
51
+ stub_request(:get, "http://datastore/records/2").to_return(status: 200, body: { id: 2 }.to_json)
52
+ stub_request(:get, "http://datastore/records/3").to_return(status: 200, body: { id: 3 }.to_json)
53
+ end
54
+
55
+ it 'finds single record in parallel' do
56
+ data = Record.find([1])
57
+ expect(data[0].identifier).to eq 123456
58
+ end
59
+
60
+ it 'finds records in parallel' do
61
+ data = Record.find([1, 2, 3])
62
+ expect(data[0].identifier).to eq 123456
63
+ end
64
+ end
39
65
  end
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: 15.0.2
4
+ version: 15.1.0
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: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lhc