lhs 24.1.1 → 24.1.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/README.md +10 -0
- data/docs/accessing-data-in-lhs.png +0 -0
- data/lib/lhs/concerns/record/request.rb +1 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/record/compact_spec.rb +2 -2
- data/spec/record/includes_expanded_spec.rb +37 -0
- data/spec/record/references_spec.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf423437a22db27b055a47b11b77edad75d4fb22895330bb33b439c03d9e89f
|
4
|
+
data.tar.gz: 228b803160ce5cfeaa801e25eac36a84fa75196ca906183336e649cd17c5604a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd83a4d879c72a201b29420021562da78945a1ef731a87023c735efe90144f1d088318c293064d9361aa559df8405132d88af0011225c43e675144d1c5af7b5f
|
7
|
+
data.tar.gz: 6da5e46c3e113bbf48a3821a02b88a6379bd54846889acb7cf77ce269be9645404d443656215979d7b3311ae1139ba07c00993542cacbd17562dc79b733af8eb
|
data/README.md
CHANGED
@@ -126,6 +126,7 @@ record.review # "Lunch was great
|
|
126
126
|
* [Include various levels of linked data](#include-various-levels-of-linked-data)
|
127
127
|
* [Identify and cast known records when including records](#identify-and-cast-known-records-when-including-records)
|
128
128
|
* [Apply options for requests performed to fetch included records](#apply-options-for-requests-performed-to-fetch-included-records)
|
129
|
+
* [compact: Remove included resources that didn't return any records](#compact-remove-included-resources-that-didnt-return-any-records)
|
129
130
|
* [Record batch processing](#record-batch-processing)
|
130
131
|
* [all](#all-1)
|
131
132
|
* [Using all, when endpoint does not implement response pagination meta data](#using-all-when-endpoint-does-not-implement-response-pagination-meta-data)
|
@@ -149,12 +150,15 @@ record.review # "Lunch was great
|
|
149
150
|
* [Test query chains](#test-query-chains)
|
150
151
|
* [By explicitly resolving the chain: fetch](#by-explicitly-resolving-the-chain-fetch)
|
151
152
|
* [Without resolving the chain: where_values_hash](#without-resolving-the-chain-where_values_hash)
|
153
|
+
* [Extended developer documentation](#extended-developer-documentation)
|
154
|
+
* [Accessing data in LHS](#accessing-data-in-lhs)
|
152
155
|
* [License](#license)
|
153
156
|
|
154
157
|
|
155
158
|
|
156
159
|
|
157
160
|
|
161
|
+
|
158
162
|
## Installation/Startup checklist
|
159
163
|
|
160
164
|
- [ ] Install LHS gem, preferably via `Gemfile`
|
@@ -2878,6 +2882,12 @@ expect(
|
|
2878
2882
|
).to eq {color: 'red', available: true}
|
2879
2883
|
```
|
2880
2884
|
|
2885
|
+
## Extended developer documentation
|
2886
|
+
|
2887
|
+
### Accessing data in LHS
|
2888
|
+
|
2889
|
+

|
2890
|
+
|
2881
2891
|
## License
|
2882
2892
|
|
2883
2893
|
[GNU General Public License Version 3.](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
Binary file
|
@@ -120,7 +120,7 @@ class LHS::Record
|
|
120
120
|
options = extend_with_reference(options, reference)
|
121
121
|
addition = load_include(options, data, sub_includes, reference)
|
122
122
|
data.extend!(addition, included)
|
123
|
-
expand_addition!(data, included,
|
123
|
+
expand_addition!(data, included, reference) unless expanded_data?(addition)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
data/lib/lhs/version.rb
CHANGED
data/spec/record/compact_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe LHS::Record do
|
|
38
38
|
limit: 10
|
39
39
|
}.to_json)
|
40
40
|
|
41
|
-
stub_request(:get, 'http://datastore/users/123/places/789
|
41
|
+
stub_request(:get, 'http://datastore/users/123/places/789')
|
42
42
|
.to_return(
|
43
43
|
body: {
|
44
44
|
href: 'http://datastore/users/123/places/789?limit=100',
|
@@ -46,7 +46,7 @@ describe LHS::Record do
|
|
46
46
|
}.to_json
|
47
47
|
)
|
48
48
|
|
49
|
-
stub_request(:get, 'http://datastore/users/123/places/790
|
49
|
+
stub_request(:get, 'http://datastore/users/123/places/790')
|
50
50
|
.to_return(
|
51
51
|
status: 404,
|
52
52
|
body: {
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
describe LHS::Record do
|
6
|
+
context 'includes all (expanded)' do
|
7
|
+
before do
|
8
|
+
class Record < LHS::Record
|
9
|
+
endpoint 'http://records/{id}'
|
10
|
+
end
|
11
|
+
|
12
|
+
stub_request(:get, "http://records/1")
|
13
|
+
.to_return(
|
14
|
+
body: {
|
15
|
+
car: { href: 'http://records/1/car' }
|
16
|
+
}.to_json
|
17
|
+
)
|
18
|
+
|
19
|
+
stub_request(:get, "http://records/1/car?color=blue&limit=100")
|
20
|
+
.to_return(
|
21
|
+
body: { href: 'http://records/cars/1' }.to_json
|
22
|
+
)
|
23
|
+
|
24
|
+
stub_request(:get, "http://records/cars/1?color=blue&limit=100")
|
25
|
+
.to_return(
|
26
|
+
body: { name: 'wrum wrum' }.to_json
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'expands linked resources and forwards proper reference' do
|
31
|
+
record = Record.includes(:car).references(car: { params: { color: :blue } }).find(1)
|
32
|
+
expect(
|
33
|
+
record.car.name
|
34
|
+
).to eq 'wrum wrum'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -76,7 +76,7 @@ describe LHS::Record do
|
|
76
76
|
}.to_json
|
77
77
|
)
|
78
78
|
|
79
|
-
stub_request(:get, 'http://datastore/customers/1/users/1
|
79
|
+
stub_request(:get, 'http://datastore/customers/1/users/1')
|
80
80
|
.with(headers: { 'Authentication' => 'Bearer 123' })
|
81
81
|
.to_return(body: { href: 'http://datastore/users/1', name: 'Elizabeth Baker' }.to_json)
|
82
82
|
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: 24.1.
|
4
|
+
version: 24.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- cider-ci/task_components/rspec.yml
|
264
264
|
- cider-ci/task_components/rubocop.yml
|
265
265
|
- cider-ci/task_components/ruby.yml
|
266
|
+
- docs/accessing-data-in-lhs.png
|
266
267
|
- friday.yml
|
267
268
|
- lhs.gemspec
|
268
269
|
- lib/lhs.rb
|
@@ -503,6 +504,7 @@ files:
|
|
503
504
|
- spec/record/href_for_spec.rb
|
504
505
|
- spec/record/ignore_errors_spec.rb
|
505
506
|
- spec/record/immutable_chains_spec.rb
|
507
|
+
- spec/record/includes_expanded_spec.rb
|
506
508
|
- spec/record/includes_first_page_spec.rb
|
507
509
|
- spec/record/includes_spec.rb
|
508
510
|
- spec/record/includes_warning_spec.rb
|
@@ -552,7 +554,7 @@ homepage: https://github.com/local-ch/lhs
|
|
552
554
|
licenses:
|
553
555
|
- GPL-3.0
|
554
556
|
metadata: {}
|
555
|
-
post_install_message:
|
557
|
+
post_install_message:
|
556
558
|
rdoc_options: []
|
557
559
|
require_paths:
|
558
560
|
- lib
|
@@ -568,8 +570,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
568
570
|
version: '0'
|
569
571
|
requirements:
|
570
572
|
- Ruby >= 2.3.0
|
571
|
-
rubygems_version: 3.0.
|
572
|
-
signing_key:
|
573
|
+
rubygems_version: 3.0.6
|
574
|
+
signing_key:
|
573
575
|
specification_version: 4
|
574
576
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|
575
577
|
interface for http (hypermedia) json services'
|
@@ -732,6 +734,7 @@ test_files:
|
|
732
734
|
- spec/record/href_for_spec.rb
|
733
735
|
- spec/record/ignore_errors_spec.rb
|
734
736
|
- spec/record/immutable_chains_spec.rb
|
737
|
+
- spec/record/includes_expanded_spec.rb
|
735
738
|
- spec/record/includes_first_page_spec.rb
|
736
739
|
- spec/record/includes_spec.rb
|
737
740
|
- spec/record/includes_warning_spec.rb
|