lhs 16.1.2 → 16.1.3
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 +3 -3
- data/lib/lhs/concerns/record/find.rb +1 -0
- data/lib/lhs/version.rb +1 -1
- data/spec/record/ignore_errors_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 270b2595ca6b508ac80989ba29b598e538b5bed03e2908a815ffb4fc30f3ff00
|
|
4
|
+
data.tar.gz: 45ed03b869ec52ff26ec336be5812984cd0707ad0d16d56d77192a9e792fba28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0124060a7c1cf3b67f0bd96eedc8acd5e0098cf4d32474da9affc86c374f8c2a0b6a61b8e3d217a9da066ccd9c4f2fd52edce10d27309f43341c8d86272c526
|
|
7
|
+
data.tar.gz: 41247150b9e353a654235e509c32a1e8ae763f4e101754c9cb0fc37aeffa4b030a7541d769d384c96a2293238f2d57be0d47915baaf68781d2e9d200d1420498
|
data/README.md
CHANGED
|
@@ -1327,7 +1327,7 @@ The kaminari’s page parameter is in params[:page]. For example, you can use ka
|
|
|
1327
1327
|
|
|
1328
1328
|
##### create
|
|
1329
1329
|
|
|
1330
|
-
`create` will return false if persisting fails. `create!` instead will an
|
|
1330
|
+
`create` will return false if persisting fails. `create!` instead will raise an exception.
|
|
1331
1331
|
|
|
1332
1332
|
`create` always builds the data of the local object first, before it tries to sync with an endpoint. So even if persisting fails, the local object is build.
|
|
1333
1333
|
|
|
@@ -1462,7 +1462,7 @@ POST https://service.example.com/records/1z-5r1fkaj { body: "{ 'name': 'Starbuck
|
|
|
1462
1462
|
|
|
1463
1463
|
`update` persists the whole object after new parameters are applied through arguments.
|
|
1464
1464
|
|
|
1465
|
-
`update` will return false if persisting fails. `update!` instead will an
|
|
1465
|
+
`update` will return false if persisting fails. `update!` instead will raise an exception.
|
|
1466
1466
|
|
|
1467
1467
|
`update` always updates the data of the local object first, before it tries to sync with an endpoint. So even if persisting fails, the local object is updated.
|
|
1468
1468
|
|
|
@@ -1493,7 +1493,7 @@ POST https://service.example.com/records/1z-5r1fkaj { body: "{ 'name': 'Starbuck
|
|
|
1493
1493
|
|
|
1494
1494
|
`partial_update` updates just the provided parameters.
|
|
1495
1495
|
|
|
1496
|
-
`partial_update` will return false if persisting fails. `partial_update!` instead will an
|
|
1496
|
+
`partial_update` will return false if persisting fails. `partial_update!` instead will raise an exception.
|
|
1497
1497
|
|
|
1498
1498
|
`partial_update` always updates the data of the local object first, before it tries to sync with an endpoint. So even if persisting fails, the local object is updated.
|
|
1499
1499
|
|
|
@@ -43,6 +43,7 @@ class LHS::Record
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def get_unique_item!(data)
|
|
46
|
+
return if data.nil?
|
|
46
47
|
if data._proxy.is_a?(LHS::Collection)
|
|
47
48
|
raise LHC::NotFound.new('Requested unique item. Multiple were found.', data._request.response) if data.length > 1
|
|
48
49
|
data.first || raise(LHC::NotFound.new('No item was found.', data._request.response))
|
data/lib/lhs/version.rb
CHANGED
|
@@ -91,6 +91,14 @@ describe LHS::Record do
|
|
|
91
91
|
expect(record).to eq nil
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
+
it 'returns nil also when ignoring errors on find with parameters' do
|
|
95
|
+
stub_request(:get, "http://local.ch/v2/records/1").to_return(status: 500, body: body)
|
|
96
|
+
record = Record
|
|
97
|
+
.ignore(LHC::Error)
|
|
98
|
+
.find(id: 1)
|
|
99
|
+
expect(record).to eq nil
|
|
100
|
+
end
|
|
101
|
+
|
|
94
102
|
it 'returns nil also when ignoring errors on fetch' do
|
|
95
103
|
stub_request(:get, "http://local.ch/v2/records?color=blue").to_return(status: 500, body: body)
|
|
96
104
|
record = Record
|
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: 16.1.
|
|
4
|
+
version: 16.1.3
|
|
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:
|
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|