dor-services-client 12.11.0 → 12.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd184715a310407f67be332d5c8f9fc3ba825ebad50532b904938a6749167db6
4
- data.tar.gz: 7a79fac8e92902504524f1ca6c09a2423dd7f25a1953759ea561aebc3cc77c82
3
+ metadata.gz: c94acf8a213cf620164db178ae247a9c2da72c00d66422febe0a8d858588f2cb
4
+ data.tar.gz: 0fb9ff1ae19620172d7fe52e91b813d3434a1edbe6d2d840e0c87319f3866e8f
5
5
  SHA512:
6
- metadata.gz: b922b6b0cbf7bd50e4ec5f7e464d4a16841a67181d4ac529143579a523b0b31589be7953d1f9a20bfa271e029e6f0856ffb4f1f8edf54cd45458c5c625bd6b67
7
- data.tar.gz: d4c75ec159921b6b03f39877546a66aa88aafd833368b8c1acdf0c368738535c7bdc21ca0a4c63a832cdeef1ff8684e2897da835cf9356d5f63ee07543d89e8e
6
+ metadata.gz: bc10a436fe0c74780a0e9d3efb4895d55683c79a4443d3a89546409b6ebae65342ba989c14430d9f3a9644150e3a321853ff2dab68c874263566fbf896854542
7
+ data.tar.gz: fe9d19f2557a2b1e03399071093c2bb7243b62528b9464d5f2a5e184bcbf63e1ecb9ad54b7ce6660799358bb26fd4bcc555f217361e8b15381ce227ec63aec5e
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (12.11.0)
4
+ dor-services-client (12.12.1)
5
5
  activesupport (>= 4.2, < 8)
6
- cocina-models (~> 0.87.0)
6
+ cocina-models (~> 0.88.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.87.0)
25
+ cocina-models (0.88.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.0)
41
+ concurrent-ruby (1.2.2)
42
42
  crack (0.4.5)
43
43
  rexml
44
44
  deprecation (1.1.0)
@@ -58,11 +58,11 @@ GEM
58
58
  dry-types (>= 1.7, < 2)
59
59
  ice_nine (~> 0.11)
60
60
  zeitwerk (~> 2.6)
61
- dry-types (1.7.0)
61
+ dry-types (1.7.1)
62
62
  concurrent-ruby (~> 1.0)
63
- dry-core (~> 1.0, < 2)
64
- dry-inflector (~> 1.0, < 2)
65
- dry-logic (>= 1.4, < 2)
63
+ dry-core (~> 1.0)
64
+ dry-inflector (~> 1.0)
65
+ dry-logic (~> 1.4)
66
66
  zeitwerk (~> 2.6)
67
67
  edtf (3.1.1)
68
68
  activesupport (>= 3.0, < 8.0)
@@ -117,19 +117,19 @@ GEM
117
117
  rspec-support (3.12.0)
118
118
  rss (0.2.9)
119
119
  rexml
120
- rubocop (1.45.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.24.1, < 2.0)
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)
131
131
  parser (>= 3.2.1.0)
132
- rubocop-capybara (2.17.0)
132
+ rubocop-capybara (2.17.1)
133
133
  rubocop (~> 1.41)
134
134
  rubocop-rspec (2.18.1)
135
135
  rubocop (~> 1.33)
@@ -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
 
@@ -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.87.0'
28
+ spec.add_dependency 'cocina-models', '~> 0.88.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] required string representing a barcode
30
- # @param catkey [String] required string representing a catkey
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 Symphony" in the body.
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 Symphony/)
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
- def check_args(barcode, catkey)
58
- raise ArgumentError, 'Barcode or catkey must be provided' if barcode.nil? && catkey.nil?
59
- raise ArgumentError, 'Both barcode and catkey may not be provided' if !barcode.nil? && !catkey.nil?
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
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '12.11.0'
6
+ VERSION = '12.12.1'
7
7
  end
8
8
  end
9
9
  end
@@ -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. for druid, barcode, catkey)
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.11.0
4
+ version: 12.12.1
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-14 00:00:00.000000000 Z
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.87.0
40
+ version: 0.88.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.87.0
47
+ version: 0.88.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.2.32
284
- signing_key:
283
+ rubygems_version: 3.3.3
284
+ signing_key:
285
285
  specification_version: 4
286
286
  summary: A client for dor-services-app
287
287
  test_files: []