lhs 14.0.2 → 14.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/record/request.rb +1 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/record/ignore_errors_spec.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2cb43c14345dbda2239e8714ea2c43ff9c41c56
|
4
|
+
data.tar.gz: 4d076f553a644860357e8adf22e9fdf8598a0afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe3a0437e13e0b82952da892e845625fb2c2039acbbf06f1c842fb8c726a957c9c0b7309ebb08d4d182bae14d605383f0108a67fb198b895b92da06c08b6fce8
|
7
|
+
data.tar.gz: 92686aae195ca9d03479f50971b3e3e3cd466f7dd615a8b1d7ab6cd9c4f43f115389b4aaef74877377baded2cfa878245fbc64676303a0dd0475328ab8ac88e2
|
@@ -495,7 +495,7 @@ class LHS::Record
|
|
495
495
|
endpoint = find_endpoint(options[:params], options.fetch(:url, nil))
|
496
496
|
apply_limit!(options) if options[:all]
|
497
497
|
response = LHC.request(process_options(options, endpoint))
|
498
|
-
return nil if response.error_ignored?
|
498
|
+
return nil if !response.success? && response.error_ignored?
|
499
499
|
data = LHS::Data.new(response.body, nil, self, response.request, endpoint)
|
500
500
|
single_request_load_and_merge_remaining_objects!(data, options, endpoint)
|
501
501
|
expand_items(data, options[:expanded]) if data.collection? && options[:expanded]
|
data/lib/lhs/version.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
describe LHS::Record do
|
4
4
|
let(:handler) { spy('handler') }
|
5
|
+
let(:record_json) { { color: 'blue' }.to_json }
|
5
6
|
|
6
7
|
before(:each) do
|
7
8
|
class Record < LHS::Record
|
@@ -79,6 +80,14 @@ describe LHS::Record do
|
|
79
80
|
expect(record).to eq nil
|
80
81
|
end
|
81
82
|
|
83
|
+
it 'returns record when ignoring errors on where' do
|
84
|
+
stub_request(:get, 'http://local.ch/v2/records?color=blue').to_return(status: 200, body: record_json)
|
85
|
+
record = Record
|
86
|
+
.ignore(LHC::Error)
|
87
|
+
.where(color: 'blue')
|
88
|
+
expect(record).not_to eq nil
|
89
|
+
end
|
90
|
+
|
82
91
|
context 'response body' do
|
83
92
|
|
84
93
|
let(:body) { { error_message: 'you are not worthy' }.to_json }
|
@@ -107,5 +116,13 @@ describe LHS::Record do
|
|
107
116
|
.find_by(color: 'blue')
|
108
117
|
expect(record).to eq nil
|
109
118
|
end
|
119
|
+
|
120
|
+
it 'returns record when ignoring errors on find' do
|
121
|
+
stub_request(:get, "http://local.ch/v2/records/1").to_return(status: 200, body: record_json)
|
122
|
+
record = Record
|
123
|
+
.ignore(LHC::Error)
|
124
|
+
.find(1)
|
125
|
+
expect(record).not_to eq nil
|
126
|
+
end
|
110
127
|
end
|
111
128
|
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: 14.0.
|
4
|
+
version: 14.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: 2017-09-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|
@@ -418,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
418
|
requirements:
|
419
419
|
- Ruby >= 2.3.0
|
420
420
|
rubyforge_project:
|
421
|
-
rubygems_version: 2.6.
|
421
|
+
rubygems_version: 2.6.13
|
422
422
|
signing_key:
|
423
423
|
specification_version: 4
|
424
424
|
summary: Rails gem providing an easy, active-record-like interface for http json services
|