lhs 19.4.0 → 19.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhs/item.rb +1 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/record/item_key_spec.rb +41 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a07eb02cb34aed5f562ed302246c31eacf746e786ffaf74d61420897662c5f3
|
4
|
+
data.tar.gz: 2d74239dda28e2d769a43d238c77b1594285283c3b676265f76643ce17649965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dabe6d68096aaba06f5c397aafd9b67d48c73209b42604b8c3579d5000c3a380bb7d58377d2bae373f45dd8d3d3fb8d834293b39e233e5259f354c50d956435
|
7
|
+
data.tar.gz: 3389c1ddcbc753e23d4d73b4d93ab28da0d837df602b096b274041c671db1bd2252b2374439268e11c5b6e7d4577a8d2a745c20f290d489ac7f2c5ca6f0ba2d7
|
data/lib/lhs/item.rb
CHANGED
@@ -54,6 +54,6 @@ class LHS::Item < LHS::Proxy
|
|
54
54
|
return _data unless _record.item_key
|
55
55
|
nested_data = _data.dig(*_record.item_key)
|
56
56
|
return _data unless nested_data
|
57
|
-
nested_data
|
57
|
+
LHS::Data.new(nested_data, _data._parent, _record, _data._request, _data._endpoint)
|
58
58
|
end
|
59
59
|
end
|
data/lib/lhs/version.rb
CHANGED
@@ -11,7 +11,7 @@ describe LHS::Record do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
let(:
|
14
|
+
let(:location_response) do
|
15
15
|
{
|
16
16
|
response: {
|
17
17
|
location: {
|
@@ -22,13 +22,13 @@ describe LHS::Record do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
let(:stub_request_by_id) do
|
25
|
-
stub_request(:get,
|
26
|
-
.to_return(body:
|
25
|
+
stub_request(:get, 'http://uberall/location/1')
|
26
|
+
.to_return(body: location_response)
|
27
27
|
end
|
28
28
|
|
29
29
|
let(:stub_request_by_get_parameters) do
|
30
|
-
stub_request(:get,
|
31
|
-
.to_return(body:
|
30
|
+
stub_request(:get, 'http://uberall/location?identifier=1&limit=1')
|
31
|
+
.to_return(body: location_response)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'uses configured item_key to unwrap response data for find' do
|
@@ -42,4 +42,40 @@ describe LHS::Record do
|
|
42
42
|
location = Location.find_by(identifier: 1)
|
43
43
|
expect(location.id).to eq 1
|
44
44
|
end
|
45
|
+
|
46
|
+
describe 'Holding on to request object' do
|
47
|
+
let(:account_response) do
|
48
|
+
{ id: 1 }.to_json
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:stub_location_by_id) do
|
52
|
+
stub_request(:get, 'http://uberall/location/1')
|
53
|
+
.to_return(headers: { 'X-Custom-Header' => 'rspec' }, body: location_response)
|
54
|
+
end
|
55
|
+
|
56
|
+
let(:stub_account_by_id) do
|
57
|
+
stub_request(:get, 'http://yext/account/1')
|
58
|
+
.to_return(headers: { 'X-Custom-Header' => 'rspec' }, body: account_response)
|
59
|
+
end
|
60
|
+
|
61
|
+
before do
|
62
|
+
class Account < LHS::Record
|
63
|
+
endpoint 'http://yext/account'
|
64
|
+
endpoint 'http://yext/account/{id}'
|
65
|
+
end
|
66
|
+
|
67
|
+
stub_location_by_id
|
68
|
+
stub_account_by_id
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'preserves request object for nested items' do
|
72
|
+
location = Location.find(1)
|
73
|
+
expect(location._request).to be_present
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'preserves request object for unnested items' do
|
77
|
+
account = Account.find(1)
|
78
|
+
expect(account._request).to be_present
|
79
|
+
end
|
80
|
+
end
|
45
81
|
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: 19.4.
|
4
|
+
version: 19.4.1
|
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: 2019-
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -480,7 +480,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
480
480
|
requirements:
|
481
481
|
- Ruby >= 2.3.0
|
482
482
|
rubyforge_project:
|
483
|
-
rubygems_version: 2.7.
|
483
|
+
rubygems_version: 2.7.6
|
484
484
|
signing_key:
|
485
485
|
specification_version: 4
|
486
486
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|