lhs 18.0.2 → 18.0.3
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/item/save.rb +5 -3
- data/lib/lhs/version.rb +1 -1
- data/spec/record/ignore_errors_spec.rb +10 -0
- 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: 88aa4428ed96338bf34f138fec43912692db335bd37ce4815606303f4746ac75
|
4
|
+
data.tar.gz: f2fe0526c31d1feaa7eadbcbfcdb97d94bf870b0196e5d61d472c1755c04c409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b474537163fb1aac0123d4e16a627499abdd7807953de68ac4800c71647befc7291c69a38391ce0359e6a051161a4a4dd200a41a3e5fc6f288a37f353ea048c0
|
7
|
+
data.tar.gz: f0e292a2197a066f28125b1df8ef6409ce7b7686baa5ff621961917079f06663efae0f298b077576ffda3fae81f0fc6c33d18306ed71d3445e099c0f98aef4f8
|
@@ -34,9 +34,11 @@ class LHS::Item < LHS::Proxy
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def create_and_merge_data!(options)
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
response_data = record.request(options)
|
38
|
+
if response_data.present?
|
39
|
+
_data.merge_raw!(response_data.unwrap(:item_created_key))
|
40
|
+
response_headers = response_data._request.response.headers
|
41
|
+
end
|
40
42
|
if response_headers && response_headers['Location']
|
41
43
|
location_data = record.request(options.merge(url: response_headers['Location'], method: :get, body: nil))
|
42
44
|
_data.merge_raw!(location_data.unwrap(:item_created_key))
|
data/lib/lhs/version.rb
CHANGED
@@ -24,6 +24,16 @@ describe LHS::Record do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
context 'ignore errors during create' do
|
28
|
+
|
29
|
+
it 'allows to ignore errors during create' do
|
30
|
+
stub_request(:post, 'http://local.ch/v2/records')
|
31
|
+
.to_return(status: 409)
|
32
|
+
record = Record.ignore(LHC::Conflict).create(name: 'Steve')
|
33
|
+
expect(record._raw).to eq(name: 'Steve')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
27
37
|
context 'multiple ignored errors' do
|
28
38
|
it 'ignores error if first of them is specified' do
|
29
39
|
stub_request(:get, "http://local.ch/v2/records?color=blue").to_return(status: 401)
|
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: 18.0.
|
4
|
+
version: 18.0.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: 2019-02-
|
11
|
+
date: 2019-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -471,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
471
471
|
requirements:
|
472
472
|
- Ruby >= 2.3.0
|
473
473
|
rubyforge_project:
|
474
|
-
rubygems_version: 2.7.
|
474
|
+
rubygems_version: 2.7.8
|
475
475
|
signing_key:
|
476
476
|
specification_version: 4
|
477
477
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|