dor-services-client 11.0.0 → 12.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe7dfec36a8319421bee77745fe97ce0b82d42ae37496dfa0b53da9924520855
4
- data.tar.gz: c52d59d1f89e919d634403fad5008034ffff6a49bc7cc36de512bac0075fb4b2
3
+ metadata.gz: 5e57addb882cfe21869e81252a7a215483d311905fdb53d7678fc6457cd83db3
4
+ data.tar.gz: be5c25a574e9f35a4abe978d8e41b0ea9356b6451a9712e8e8a4ded07cd29c09
5
5
  SHA512:
6
- metadata.gz: f9698a746b759eff42f1b12ab31413c5c28527f1080649b8a8d9e62d56200871ae7907308d32161efaae83aa0507e95367e1d1566f401046246f200978e9253a
7
- data.tar.gz: d76e0a78928835868bcc058369ea0f38933290110d42517d7b7440ccaa27eb3f45f41432de90e4b7e19031faeea2332f3236f1293edd462fc1feefc05aea6111
6
+ metadata.gz: 37f68e8f714e613515adcecc7111ed4aa2f2eea8fbeff9371d4da36dd3ae2bc04fd154e7eaf5e6442312ba201ad94c5a002262ce8c6ece13073f3a4fe3e99d75
7
+ data.tar.gz: b720308ed75a59766a4e9205b1ee9087b72a508e062ae51602b9fdef480db2b720b3c09d19aba98bed7dafd7b0e57d697b90260b2310a7aa55ba55c658dae027
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = '>= 2.7', '< 4' # dor-services-app needs 2.7 due to fedora3
26
26
 
27
27
  spec.add_dependency 'activesupport', '>= 4.2', '< 8'
28
- spec.add_dependency 'cocina-models', '~> 0.78.0' # leave pinned to patch level until cocina-models hits 1.0
28
+ spec.add_dependency 'cocina-models', '~> 0.80.0' # leave pinned to patch level until cocina-models hits 1.0
29
29
  spec.add_dependency 'deprecation', '>= 0'
30
30
  spec.add_dependency 'faraday', '~> 2.0'
31
31
  spec.add_dependency 'faraday-retry'
@@ -61,20 +61,6 @@ module Dor
61
61
  raise_exception_based_on_response!(resp, object_identifier)
62
62
  end
63
63
 
64
- # Update the MODS XML metadata
65
- # @raise [NotFoundResponse] when the response is a 404 (object not found)
66
- # @return [boolean] true on success
67
- def update_mods(mods_xml)
68
- resp = connection.put do |req|
69
- req.url "#{base_path}/mods"
70
- req.headers['Content-Type'] = 'application/xml'
71
- req.body = mods_xml
72
- end
73
- return if resp.success?
74
-
75
- raise_exception_based_on_response!(resp, object_identifier)
76
- end
77
-
78
64
  private
79
65
 
80
66
  attr_reader :object_identifier
@@ -28,13 +28,14 @@ module Dor
28
28
  # Updates the object
29
29
  # @param [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata|DRO|Collection|AdminPolicy] params model object
30
30
  # @param [boolean] skip_lock do not provide ETag
31
+ # @param [boolean] validate validate the response object
31
32
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
32
33
  # @raise [UnexpectedResponse] when the response is not successful.
33
34
  # @raise [BadRequestError] when ETag not provided.
34
35
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
35
36
  # rubocop:disable Metrics/AbcSize
36
37
  # rubocop:disable Metrics/MethodLength
37
- def update(params:, skip_lock: false)
38
+ def update(params:, skip_lock: false, validate: false)
38
39
  raise ArgumentError, 'Cocina object not provided.' unless params.respond_to?(:externalIdentifier)
39
40
 
40
41
  # Raised if Cocina::Models::*WithMetadata not provided.
@@ -51,7 +52,7 @@ module Dor
51
52
 
52
53
  raise_exception_based_on_response!(resp) unless resp.success?
53
54
 
54
- build_cocina_from_response(resp)
55
+ build_cocina_from_response(resp, validate: validate)
55
56
  end
56
57
  # rubocop:enable Metrics/AbcSize
57
58
  # rubocop:enable Metrics/MethodLength
@@ -71,12 +72,15 @@ module Dor
71
72
  end
72
73
 
73
74
  # Destroys an object
75
+ # @param [String] user_name (nil) the user name of the user doing the destroy
74
76
  # @return [Boolean] true if successful
75
77
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
76
78
  # @raise [UnexpectedResponse] if the request is unsuccessful.
77
- def destroy
79
+ def destroy(user_name: nil)
80
+ path = object_path
81
+ path += "?user_name=#{user_name}" if user_name
78
82
  resp = connection.delete do |req|
79
- req.url object_path
83
+ req.url path
80
84
  end
81
85
  raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
82
86
 
@@ -43,16 +43,17 @@ module Dor
43
43
  end
44
44
 
45
45
  # Retrieves the Cocina model
46
+ # @param [boolean] validate validate the response object
46
47
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
47
48
  # @raise [UnexpectedResponse] when the response is not successful.
48
49
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
49
- def find
50
+ def find(validate: false)
50
51
  resp = connection.get do |req|
51
52
  req.url object_path
52
53
  end
53
54
  raise_exception_based_on_response!(resp) unless resp.success?
54
55
 
55
- build_cocina_from_response(resp)
56
+ build_cocina_from_response(resp, validate: validate)
56
57
  end
57
58
 
58
59
  # Get a list of the collections. (Similar to Valkyrie's find_inverse_references_by)
@@ -10,8 +10,9 @@ module Dor
10
10
  # Creates a new object in DOR
11
11
  # @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAdminPolicy]
12
12
  # @param assign_doi [Boolean]
13
+ # @param [boolean] validate validate the response object
13
14
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
14
- def register(params:, assign_doi: false)
15
+ def register(params:, assign_doi: false, validate: false)
15
16
  resp = connection.post do |req|
16
17
  req.url "#{api_version}/objects"
17
18
  req.headers['Content-Type'] = 'application/json'
@@ -23,7 +24,7 @@ module Dor
23
24
 
24
25
  raise_exception_based_on_response!(resp) unless resp.success?
25
26
 
26
- build_cocina_from_response(resp)
27
+ build_cocina_from_response(resp, validate: validate)
27
28
  end
28
29
  end
29
30
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '11.0.0'
6
+ VERSION = '12.2.0'
7
7
  end
8
8
  end
9
9
  end
@@ -41,8 +41,8 @@ module Dor
41
41
  errors: data.fetch('errors', []))
42
42
  end
43
43
 
44
- def build_cocina_from_response(response)
45
- cocina_object = Cocina::Models.build(JSON.parse(response.body))
44
+ def build_cocina_from_response(response, validate: false)
45
+ cocina_object = Cocina::Models.build(JSON.parse(response.body), validate: validate)
46
46
  Cocina::Models.with_metadata(cocina_object, response.headers['ETag'], created: date_from_header(response, 'X-Created-At'),
47
47
  modified: date_from_header(response, 'Last-Modified'))
48
48
  end
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: 11.0.0
4
+ version: 12.2.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: 2022-05-04 00:00:00.000000000 Z
12
+ date: 2022-05-24 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.78.0
40
+ version: 0.80.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.78.0
47
+ version: 0.80.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
@@ -261,7 +261,7 @@ homepage: https://github.com/sul-dlss/dor-services-client
261
261
  licenses: []
262
262
  metadata:
263
263
  rubygems_mfa_required: 'true'
264
- post_install_message:
264
+ post_install_message:
265
265
  rdoc_options: []
266
266
  require_paths:
267
267
  - lib
@@ -279,8 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
279
  - !ruby/object:Gem::Version
280
280
  version: '0'
281
281
  requirements: []
282
- rubygems_version: 3.3.4
283
- signing_key:
282
+ rubygems_version: 3.3.7
283
+ signing_key:
284
284
  specification_version: 4
285
285
  summary: A client for dor-services-app
286
286
  test_files: []