folio_api_client 0.4.2 → 0.4.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 +1 -0
- data/lib/folio_api_client/finders.rb +26 -3
- data/lib/folio_api_client/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: c9101df88d1bcae72de9607a5646631b5b4a3ecb2f281f4e81064ea47b1ee9b3
|
4
|
+
data.tar.gz: b9e838309973de0b1b66069bf2aa7c6a5c96f32f8a6b8d167a8cb9cc07d87626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f087226a449dc37b26445d40f0d99fe752c6f9203123bc0d6aef87f050a5257c0c6b371ee7441905406454933ecb9d37df1c539a21a82f068d6ded468902663
|
7
|
+
data.tar.gz: e8d41ca37c67901d6db368509e72f1360bcd509e71a179aa6443defe544d145bcef7a2a56e0f1a40c16dae7ad1d914c0a3e1f36d9d6197470d08479883307e8b
|
data/README.md
CHANGED
@@ -47,6 +47,7 @@ client.delete(path, body, content_type: 'application/json'))
|
|
47
47
|
|
48
48
|
client.find_item_record(barcode: 'some-barcode')
|
49
49
|
client.find_location_record(location_id: 'some-location-id')
|
50
|
+
client.find_location_record(code: 'some-location-code')
|
50
51
|
client.find_material_type_record(material_type_id: 'some-material-type-id')
|
51
52
|
client.find_holdings_record(holdings_record_id: 'some-holdings-record-id')
|
52
53
|
client.find_instance_record(instance_record_id: 'some-instance-record-id')
|
@@ -14,10 +14,26 @@ class FolioApiClient
|
|
14
14
|
item_search_results.first
|
15
15
|
end
|
16
16
|
|
17
|
-
def find_location_record(location_id:)
|
18
|
-
|
17
|
+
def find_location_record(location_id: nil, code: nil) # rubocop:disable Metrics/MethodLength
|
18
|
+
if location_id
|
19
|
+
return self.get("/locations/#{location_id}")
|
20
|
+
elsif code
|
21
|
+
location_record_search_results = self.get(
|
22
|
+
'/locations',
|
23
|
+
location_record_query(code: code)
|
24
|
+
)['locations']
|
25
|
+
|
26
|
+
return nil if location_record_search_results.empty?
|
27
|
+
|
28
|
+
if location_record_search_results.length > 1
|
29
|
+
raise FolioApiClient::Exceptions::UnexpectedMultipleRecordsFoundError,
|
30
|
+
'Only expected one location with this code, but found more than one.'
|
31
|
+
end
|
32
|
+
|
33
|
+
return location_record_search_results.first
|
34
|
+
end
|
19
35
|
|
20
|
-
|
36
|
+
nil
|
21
37
|
rescue Faraday::ResourceNotFound
|
22
38
|
nil
|
23
39
|
end
|
@@ -89,5 +105,12 @@ class FolioApiClient
|
|
89
105
|
raise FolioApiClient::Exceptions::MissingQueryFieldError,
|
90
106
|
'Missing query field. Must supply either an instance_record_id or instance_record_hrid.'
|
91
107
|
end
|
108
|
+
|
109
|
+
def location_record_query(code: nil)
|
110
|
+
return { query: "code==#{code}", limit: 2 } if code
|
111
|
+
|
112
|
+
raise FolioApiClient::Exceptions::MissingQueryFieldError,
|
113
|
+
'Missing query field. Must supply a code.'
|
114
|
+
end
|
92
115
|
end
|
93
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: folio_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric O'Hanlon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|