dor-services-client 12.12.0 → 12.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -6
- data/README.md +3 -3
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/marcxml.rb +14 -30
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22e842b08c8256b5759b6e9074831eb00665cca337049f17e4765807af6567f3
|
4
|
+
data.tar.gz: b17954f26df680698d3a320a40690952d6877d4571010b4bf76b3b8437dec0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a179f70a005461425441858cf2e5cb6d65f5638d45446fa01387c4c302e851be49907b65a447e53dc164849240661b240ecb5c5e6b6ef8e2f5c6d9646864de48
|
7
|
+
data.tar.gz: 8052171595c0c2d28280f6527e9ac73afff131488f8e87d3a9d22b1e6fe295a207e4a923d99fc47357b518f26169f2458f40f9f5a5f860375faff50c3f7f80bd
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dor-services-client (12.
|
4
|
+
dor-services-client (12.13.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
|
-
cocina-models (~> 0.
|
6
|
+
cocina-models (~> 0.89.0)
|
7
7
|
deprecation
|
8
8
|
faraday (~> 2.0)
|
9
9
|
faraday-retry
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
ast (2.4.2)
|
23
23
|
attr_extras (7.1.0)
|
24
24
|
byebug (11.1.3)
|
25
|
-
cocina-models (0.
|
25
|
+
cocina-models (0.89.0)
|
26
26
|
activesupport
|
27
27
|
deprecation
|
28
28
|
dry-struct (~> 1.0)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
thor
|
39
39
|
zeitwerk (~> 2.1)
|
40
40
|
commonmarker (0.23.8)
|
41
|
-
concurrent-ruby (1.2.
|
41
|
+
concurrent-ruby (1.2.2)
|
42
42
|
crack (0.4.5)
|
43
43
|
rexml
|
44
44
|
deprecation (1.1.0)
|
@@ -117,14 +117,14 @@ GEM
|
|
117
117
|
rspec-support (3.12.0)
|
118
118
|
rss (0.2.9)
|
119
119
|
rexml
|
120
|
-
rubocop (1.
|
120
|
+
rubocop (1.46.0)
|
121
121
|
json (~> 2.3)
|
122
122
|
parallel (~> 1.10)
|
123
123
|
parser (>= 3.2.0.0)
|
124
124
|
rainbow (>= 2.2.2, < 4.0)
|
125
125
|
regexp_parser (>= 1.8, < 3.0)
|
126
126
|
rexml (>= 3.2.5, < 4.0)
|
127
|
-
rubocop-ast (>= 1.
|
127
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
128
128
|
ruby-progressbar (~> 1.7)
|
129
129
|
unicode-display_width (>= 2.4.0, < 3.0)
|
130
130
|
rubocop-ast (1.26.0)
|
@@ -158,6 +158,7 @@ GEM
|
|
158
158
|
|
159
159
|
PLATFORMS
|
160
160
|
x86_64-darwin-19
|
161
|
+
x86_64-darwin-20
|
161
162
|
x86_64-darwin-21
|
162
163
|
x86_64-linux
|
163
164
|
|
data/README.md
CHANGED
@@ -81,15 +81,15 @@ background_jobs_client.show(job_id: 123)
|
|
81
81
|
# Perform MARCXML operations
|
82
82
|
marcxml_client = Dor::Services::Client.marcxml
|
83
83
|
|
84
|
-
# Retrieve a catkey for a given barcode
|
85
|
-
marcxml_client.catkey(barcode: '123456789')
|
86
|
-
|
87
84
|
# Retrieve MARCXML for a given barcode
|
88
85
|
marcxml_client.marcxml(barcode: '123456789')
|
89
86
|
|
90
87
|
# Retrieve MARCXML for a given catkey
|
91
88
|
marcxml_client.marcxml(catkey: '987654321')
|
92
89
|
|
90
|
+
# Retrieve MARCXML for a given FOLIO instance HRID
|
91
|
+
marcxml_client.marcxml(folio_instance_hrid: 'in000123')
|
92
|
+
|
93
93
|
# For performing operations on a known, registered object
|
94
94
|
object_client = Dor::Services::Client.object(object_identifier)
|
95
95
|
|
data/dor-services-client.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '>= 3.0', '< 4'
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 4.2', '< 8'
|
28
|
-
spec.add_dependency 'cocina-models', '~> 0.
|
28
|
+
spec.add_dependency 'cocina-models', '~> 0.89.0'
|
29
29
|
spec.add_dependency 'deprecation', '>= 0'
|
30
30
|
spec.add_dependency 'faraday', '~> 2.0'
|
31
31
|
spec.add_dependency 'faraday-retry'
|
@@ -5,47 +5,29 @@ module Dor
|
|
5
5
|
class Client
|
6
6
|
# API calls around MARCXML-based operations from dor-services-app
|
7
7
|
class Marcxml < VersionedService
|
8
|
-
# Get a catkey corresponding to a barcode
|
9
|
-
# @param barcode [String] required string representing a barcode
|
10
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
11
|
-
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
12
|
-
# @return [String] catkey
|
13
|
-
def catkey(barcode:)
|
14
|
-
resp = connection.get do |req|
|
15
|
-
req.url "#{api_version}/catalog/catkey"
|
16
|
-
req.params['barcode'] = barcode
|
17
|
-
end
|
18
|
-
|
19
|
-
return resp.body if resp.success? && resp.body.present?
|
20
|
-
|
21
|
-
# This method needs its own exception handling logic due to how the endpoint service (SearchWorks) operates
|
22
|
-
# raise a NotFoundResponse because the resource being requested was not found in the ILS (via dor-services-app)
|
23
|
-
raise NotFoundResponse.new(response: resp) if resp.success? && resp.body.blank?
|
24
|
-
|
25
|
-
raise UnexpectedResponse.new(response: resp)
|
26
|
-
end
|
27
|
-
|
28
8
|
# Gets MARCXML corresponding to a barcode or catkey
|
29
|
-
# @param barcode [String]
|
30
|
-
# @param catkey [String]
|
9
|
+
# @param barcode [String] string representing a barcode
|
10
|
+
# @param catkey [String] string representing a catkey
|
11
|
+
# @param folio_instance_hrid [String] string representing a Folio instance HRID
|
31
12
|
# @raise [NotFoundResponse] when the response is a 500 with "Record not found in Symphony"
|
32
13
|
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
33
14
|
# @return [String] MARCXML
|
34
|
-
def marcxml(barcode: nil, catkey: nil)
|
35
|
-
check_args(barcode, catkey)
|
15
|
+
def marcxml(barcode: nil, catkey: nil, folio_instance_hrid: nil)
|
16
|
+
check_args(barcode, catkey, folio_instance_hrid)
|
36
17
|
|
37
18
|
resp = connection.get do |req|
|
38
19
|
req.url "#{api_version}/catalog/marcxml"
|
39
20
|
req.params['barcode'] = barcode unless barcode.nil?
|
40
21
|
req.params['catkey'] = catkey unless catkey.nil?
|
22
|
+
req.params['folio_instance_hrid'] = folio_instance_hrid unless folio_instance_hrid.nil?
|
41
23
|
end
|
42
24
|
|
43
25
|
# This method needs its own exception handling logic due to how the endpoint service (Symphony) operates
|
44
26
|
|
45
|
-
# DOR Services App does not respond with a 404 when no match in Symphony.
|
46
|
-
# Rather, it responds with a 500 containing "Record not found in
|
27
|
+
# DOR Services App does not respond with a 404 when no match in Symphony or Folio.
|
28
|
+
# Rather, it responds with a 500 containing "Record not found in catalog" in the body.
|
47
29
|
# raise a NotFoundResponse because the resource being requested was not found in the ILS (via dor-services-app)
|
48
|
-
raise NotFoundResponse.new(response: resp) if !resp.success? && resp.body.match?(/Record not found in
|
30
|
+
raise NotFoundResponse.new(response: resp) if !resp.success? && resp.body.match?(/Record not found in catalog/)
|
49
31
|
|
50
32
|
raise UnexpectedResponse.new(response: resp) unless resp.success?
|
51
33
|
|
@@ -54,10 +36,12 @@ module Dor
|
|
54
36
|
|
55
37
|
private
|
56
38
|
|
57
|
-
|
58
|
-
|
59
|
-
raise ArgumentError, '
|
39
|
+
# rubocop:disable Layout/LineLength
|
40
|
+
def check_args(barcode, catkey, folio_instance_hrid)
|
41
|
+
raise ArgumentError, 'Barcode, catkey, or folio_instance_hrid must be provided' if barcode.nil? && catkey.nil? && folio_instance_hrid.nil?
|
42
|
+
raise ArgumentError, 'Both barcode and a catalog id (catkey or folio_instance_hrid) may not be provided' if !barcode.nil? && (!catkey.nil? || !folio_instance_hrid.nil?)
|
60
43
|
end
|
44
|
+
# rubocop:enable Layout/LineLength
|
61
45
|
end
|
62
46
|
end
|
63
47
|
end
|
data/lib/dor/services/client.rb
CHANGED
@@ -27,7 +27,7 @@ module Dor
|
|
27
27
|
# Base class for Dor::Services::Client exceptions
|
28
28
|
class Error < StandardError; end
|
29
29
|
|
30
|
-
# Error that is raised when the ultimate remote server returns a 404 Not Found for the id in our request (e.g.
|
30
|
+
# Error that is raised when the ultimate remote server returns a 404 Not Found for the id in our request (e.g. druid, barcode, catkey, folio_instance_hrid)
|
31
31
|
class NotFoundResponse < Error; end
|
32
32
|
|
33
33
|
# Error that is raised when the remote server returns some unparsable response
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
- Michael Giarlo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02-
|
12
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -37,14 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.89.0
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.89.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: deprecation
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,7 +213,7 @@ dependencies:
|
|
213
213
|
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
|
-
description:
|
216
|
+
description:
|
217
217
|
email:
|
218
218
|
- jcoyne@justincoyne.com
|
219
219
|
- leftwing@alumni.rutgers.edu
|
@@ -262,7 +262,7 @@ homepage: https://github.com/sul-dlss/dor-services-client
|
|
262
262
|
licenses: []
|
263
263
|
metadata:
|
264
264
|
rubygems_mfa_required: 'true'
|
265
|
-
post_install_message:
|
265
|
+
post_install_message:
|
266
266
|
rdoc_options: []
|
267
267
|
require_paths:
|
268
268
|
- lib
|
@@ -280,8 +280,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
- !ruby/object:Gem::Version
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
|
-
rubygems_version: 3.
|
284
|
-
signing_key:
|
283
|
+
rubygems_version: 3.2.32
|
284
|
+
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: A client for dor-services-app
|
287
287
|
test_files: []
|