dor-services-client 12.12.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: '0785a4251d87011c92d747b53287decd18d38d87ced4f7b0314b065e8de1171c'
4
- data.tar.gz: 29a9f5bf2a4bd0778163e8219f457b354bd355ff9cb5a8c1150e2cd786d1899e
3
+ metadata.gz: c94acf8a213cf620164db178ae247a9c2da72c00d66422febe0a8d858588f2cb
4
+ data.tar.gz: 0fb9ff1ae19620172d7fe52e91b813d3434a1edbe6d2d840e0c87319f3866e8f
5
5
  SHA512:
6
- metadata.gz: 8ceb855f09e1392aff2e7aed507960e291a3be66062dcd8b78a238774d4a5b82dbfe0ce6aa37fea21122a823dfebf864810991cf29adeba60f97b4b9e0f1cb59
7
- data.tar.gz: d5d5920229c2d8e770a5e941da31d8d273dd59076dbe3647e2d155f886025193a030395f3e994c52c02af162467e8519fee059e9141e56f67cee311379e457bb
6
+ metadata.gz: bc10a436fe0c74780a0e9d3efb4895d55683c79a4443d3a89546409b6ebae65342ba989c14430d9f3a9644150e3a321853ff2dab68c874263566fbf896854542
7
+ data.tar.gz: fe9d19f2557a2b1e03399071093c2bb7243b62528b9464d5f2a5e184bcbf63e1ecb9ad54b7ce6660799358bb26fd4bcc555f217361e8b15381ce227ec63aec5e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (12.12.0)
4
+ dor-services-client (12.12.1)
5
5
  activesupport (>= 4.2, < 8)
6
6
  cocina-models (~> 0.88.0)
7
7
  deprecation
@@ -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)
@@ -117,14 +117,14 @@ 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)
@@ -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
 
@@ -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.12.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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.12.0
4
+ version: 12.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-02-22 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
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
282
  requirements: []
283
- rubygems_version: 3.3.7
283
+ rubygems_version: 3.3.3
284
284
  signing_key:
285
285
  specification_version: 4
286
286
  summary: A client for dor-services-app