lhs 17.0.1.pre1 → 17.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.activesupport4 +1 -0
- data/README.md +31 -0
- data/cider-ci/bin/bundle +2 -0
- data/lib/lhs/concerns/record/endpoints.rb +1 -0
- data/lib/lhs/record.rb +0 -2
- data/lib/lhs/version.rb +1 -1
- 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: 26f630cf54aef6e5cea546ba548bd0887c29b0c3e65266970b70565749738a73
|
4
|
+
data.tar.gz: 71a4ac28abd38913e0e170cc928a0770fce1b82d680e271b09daa06520a73290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2c866f8435f31e03325f5062741ae469db4e7a2d72230725153a7526fbc1bfaa02110f795becb6689d1f228e17db91aed4173a119dbf605e26f09c713030e81
|
7
|
+
data.tar.gz: 3319744ddd423474740a28f695e76bdcf2cd46be27482b7f8c949f6c8ee9648f54157aec10e2d2ca7e52e47079f1853e1530c95583e0754d81f7f8759489c803
|
data/Gemfile.activesupport4
CHANGED
data/README.md
CHANGED
@@ -48,8 +48,11 @@ record.review # "Lunch was great
|
|
48
48
|
* [Ambiguous endpoints](#ambiguous-endpoints)
|
49
49
|
* [Record inheritance](#record-inheritance)
|
50
50
|
* [Find multiple records](#find-multiple-records)
|
51
|
+
* [fetch](#fetch)
|
51
52
|
* [where](#where)
|
52
53
|
* [Reuse/Dry where statements: Use scopes](#reusedry-where-statements-use-scopes)
|
54
|
+
* [all](#all)
|
55
|
+
* [all with unpaginated endpoints](#all-with-unpaginated-endpoints)
|
53
56
|
* [Retrieve the amount of a collection of items: count vs. length](#retrieve-the-amount-of-a-collection-of-items-count-vs-length)
|
54
57
|
* [Find single records](#find-single-records)
|
55
58
|
* [find](#find)
|
@@ -65,6 +68,7 @@ record.review # "Lunch was great
|
|
65
68
|
* [has_one](#has_one)
|
66
69
|
* [Unwrap nested items from the response body](#unwrap-nested-items-from-the-response-body)
|
67
70
|
* [Determine collections from the response body](#determine-collections-from-the-response-body)
|
71
|
+
* [Load additional data based on retrieved data](#load-additional-data-based-on-retrieved-data)
|
68
72
|
* [Chain complex queries](#chain-complex-queries)
|
69
73
|
* [Chain where queries](#chain-where-queries)
|
70
74
|
* [Expand plain collections of links: expanded](#expand-plain-collections-of-links-expanded)
|
@@ -741,6 +745,33 @@ GET https://service.example.com/search?q=Starbucks
|
|
741
745
|
{... docs: [... {... address: 'Bahnhofstrasse 5, 8000 Zürich' }] }
|
742
746
|
```
|
743
747
|
|
748
|
+
#### Load additional data based on retrieved data
|
749
|
+
|
750
|
+
In order to load linked data from already retrieved data, you can use `load!` (or `reload!`).
|
751
|
+
|
752
|
+
```ruby
|
753
|
+
# app/controllers/some_controller.rb
|
754
|
+
|
755
|
+
record = Record.find(1)
|
756
|
+
record.associated_thing.load!
|
757
|
+
```
|
758
|
+
```
|
759
|
+
GET https://things/4
|
760
|
+
{ name: "Steve" }
|
761
|
+
```
|
762
|
+
```ruby
|
763
|
+
# app/controllers/some_controller.rb
|
764
|
+
record.associated_thing.name # Steve
|
765
|
+
|
766
|
+
record.associated_thing.load! # Does NOT create another request, as it is already loaded
|
767
|
+
record.associated_thing.reload! # Does request the data again from remote
|
768
|
+
|
769
|
+
```
|
770
|
+
```
|
771
|
+
GET https://things/4
|
772
|
+
{ name: "Steve" }
|
773
|
+
```
|
774
|
+
|
744
775
|
### Chain complex queries
|
745
776
|
|
746
777
|
> [Method chaining](https://en.wikipedia.org/wiki/Method_chaining), also known as named parameter idiom, is a common syntax for invoking multiple method calls in object-oriented programming languages. Each method returns an object, allowing the calls to be chained together without requiring variables to store the intermediate results
|
data/cider-ci/bin/bundle
CHANGED
data/lib/lhs/record.rb
CHANGED
data/lib/lhs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 17.0.1
|
4
|
+
version: 17.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
@@ -464,9 +464,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
464
464
|
version: 2.3.0
|
465
465
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
466
466
|
requirements:
|
467
|
-
- - "
|
467
|
+
- - ">="
|
468
468
|
- !ruby/object:Gem::Version
|
469
|
-
version:
|
469
|
+
version: '0'
|
470
470
|
requirements:
|
471
471
|
- Ruby >= 2.3.0
|
472
472
|
rubyforge_project:
|