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 +4 -4
- data/lib/lhs/concerns/record/find.rb +7 -2
- data/lib/lhs/version.rb +1 -1
- data/spec/record/find_in_parallel_spec.rb +26 -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: dc82efba3ea225c25ce9a6ae38a8664fd35a1cae
|
4
|
+
data.tar.gz: 791d7413db7537cb712d7a23fb2ce4d9a90c608b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
22
|
-
data
|
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
|
data/lib/lhs/version.rb
CHANGED
@@ -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
|
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-
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|