fulfil_api 0.1.4 → 0.1.5
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/lib/fulfil_api/resource/relation/query_methods.rb +12 -0
- data/lib/fulfil_api/resource.rb +1 -0
- data/lib/fulfil_api/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: cb30711ccea7942e991ecf77dcc3c25290752c09d83674c822c018d4d8c7fcde
|
4
|
+
data.tar.gz: 82e58d3494b0b0a8d73d7ff3c4bd2d96fb79b599f3588bda3b1c4035fd22fcf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f2ac1b0f4d06d7d55cbf0a2f69cf5fd566ad514439a983270d0f14e1235c38a2c258b3f97dccd4589c81d4f1942309fa4eae5ce9e5c719b29ee104555e2692a
|
7
|
+
data.tar.gz: ca9fd568544fb12b16d8a656667c7ca09d8c1583d8e29324fa8d9ed924a5d380fee2ff7fd7a435b987f744c561a278bea657f5f538331a461c8288265c7f4430
|
@@ -21,6 +21,18 @@ module FulfilApi
|
|
21
21
|
where(conditions).limit(1).first
|
22
22
|
end
|
23
23
|
|
24
|
+
# Finds the first resource that matches the given conditions and raises
|
25
|
+
# when no resource is found.
|
26
|
+
#
|
27
|
+
# @see .find_by
|
28
|
+
#
|
29
|
+
# @param conditions [Array<String, String, String>] The filter conditions as required by Fulfil.
|
30
|
+
# @return [FulfilApi::Resource] The first resource that matches the conditions
|
31
|
+
# @raise [FulfilApi::Resource::NotFound]
|
32
|
+
def find_by!(conditions)
|
33
|
+
find_by(conditions) || raise(NotFound, "Unable to find #{model_name} where #{conditions}")
|
34
|
+
end
|
35
|
+
|
24
36
|
# Limits the number of resources returned by Fulfil's API. This is useful when only
|
25
37
|
# a specific number of resources are needed.
|
26
38
|
#
|
data/lib/fulfil_api/resource.rb
CHANGED
data/lib/fulfil_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulfil_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vermaas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.5.
|
124
|
+
rubygems_version: 3.5.18
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A HTTP client to interact the Fulfil.io API
|