fmrest 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/fmrest/errors.rb +1 -0
- data/lib/fmrest/spyke/model/orm.rb +14 -1
- data/lib/fmrest/v1/raise_errors.rb +3 -1
- data/lib/fmrest/version.rb +1 -1
- 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: 368ed06195288490b1388c451b00bb33f5c19e526348422a3760a14902459d76
|
4
|
+
data.tar.gz: a445ef1bd8ef708b6aea2c5f8c2362f77e8c1afbd80bb6ef1d354c669ef8c9f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2e8cb78c9a232f8ec13dde7ad3407f5dbfc14c49c0e5aadeb7a940c1fe07f14e919832b53841e4ac054f81c74a64fb7721614218c342835a2274c3b187aa96
|
7
|
+
data.tar.gz: 9695ef91a8eef005420c0003e62eb1712eda8f11667e87f345c311b008c712113b4ff52be31e1fc207237efc7e7279d5952b2d0b2ed3b4a26a2a8aa55ad38638
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 0.4.1
|
4
|
+
|
5
|
+
* Prevent raising an exception when a /\_find request yields no results
|
6
|
+
([#33](https://github.com/beezwax/fmrest-ruby/issues/33) and
|
7
|
+
[#34](https://github.com/beezwax/fmrest-ruby/issues/34))
|
8
|
+
|
3
9
|
### 0.4.0
|
4
10
|
|
5
11
|
* Implement ability to set limit and offset for portals
|
data/lib/fmrest/errors.rb
CHANGED
@@ -18,6 +18,7 @@ module FmRest
|
|
18
18
|
class APIError::AccountError < APIError; end # error codes 200..299
|
19
19
|
class APIError::LockError < APIError; end # error codes 300..399
|
20
20
|
class APIError::ParameterError < APIError; end # error codes 400..499
|
21
|
+
class APIError::NoMatchingRecordsError < APIError::ParameterError; end
|
21
22
|
class APIError::ValidationError < APIError; end # error codes 500..599
|
22
23
|
class APIError::SystemError < APIError; end # error codes 800..899
|
23
24
|
class APIError::ScriptError < APIError; end # error codes 1200..1299
|
@@ -13,6 +13,10 @@ module FmRest
|
|
13
13
|
class_attribute :default_limit, instance_accessor: false, instance_predicate: false
|
14
14
|
|
15
15
|
class_attribute :default_sort, instance_accessor: false, instance_predicate: false
|
16
|
+
|
17
|
+
# Whether to raise an FmRest::APIError::NoMatchingRecordsError when a
|
18
|
+
# _find request has no results
|
19
|
+
class_attribute :raise_on_no_matching_records, instance_accessor: false, instance_predicate: false
|
16
20
|
end
|
17
21
|
|
18
22
|
class_methods do
|
@@ -42,7 +46,16 @@ module FmRest
|
|
42
46
|
end
|
43
47
|
|
44
48
|
previous, self.current_scope = current_scope, scope
|
45
|
-
|
49
|
+
|
50
|
+
# The DAPI returns a 401 "No records match the request" error when
|
51
|
+
# nothing matches a _find request, so we need to catch it in order
|
52
|
+
# to provide sane behavior (i.e. return an empty resultset)
|
53
|
+
begin
|
54
|
+
current_scope.has_query? ? scoped_request(:post) : super
|
55
|
+
rescue FmRest::APIError::NoMatchingRecordsError => e
|
56
|
+
raise e if raise_on_no_matching_records
|
57
|
+
::Spyke::Result.new({})
|
58
|
+
end
|
46
59
|
ensure
|
47
60
|
self.current_scope = previous
|
48
61
|
end
|
@@ -18,7 +18,9 @@ module FmRest
|
|
18
18
|
102..199 => APIError::ResourceMissingError,
|
19
19
|
200..299 => APIError::AccountError,
|
20
20
|
300..399 => APIError::LockError,
|
21
|
-
400
|
21
|
+
400 => APIError::ParameterError,
|
22
|
+
401 => APIError::NoMatchingRecordsError,
|
23
|
+
402..499 => APIError::ParameterError,
|
22
24
|
500..599 => APIError::ValidationError,
|
23
25
|
800..899 => APIError::SystemError,
|
24
26
|
1200..1299 => APIError::ScriptError,
|
data/lib/fmrest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fmrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Carbajal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|