dor-services-client 9.1.1 → 10.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92add95b112e8d9c6cdce2ba2e91e08d4a49cb4d3329868c34441fe272fcc9c2
|
4
|
+
data.tar.gz: 18e2a92e7a11955f46ce18f832a0942dbbac87e300d3910e9cbddbb8ee7681fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab5c196702ecdf1fca112cc9e65ab4e0136a9f4d79a0f96e8b31a7d4b71cf3d2daa978cf59234190fba35d0674f31449f6a8c4ac5a2fac9c9fd38e933a4102e
|
7
|
+
data.tar.gz: 8882218dba3fa8266a19ea4c299569fd62c1b41b32119bf897b65d4333687df943c407e84bb3f48d213317caa40b8245ea4810eaf6e69f32b836bc6e262cc2aa
|
data/.rubocop.yml
CHANGED
@@ -33,7 +33,10 @@ module Dor
|
|
33
33
|
# @raise [BadRequestError] when ETag not provided.
|
34
34
|
# @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
|
35
35
|
# rubocop:disable Metrics/AbcSize
|
36
|
+
# rubocop:disable Metrics/MethodLength
|
36
37
|
def update(params:, skip_lock: false)
|
38
|
+
raise ArgumentError, 'Cocina object not provided.' unless params.respond_to?(:externalIdentifier)
|
39
|
+
|
37
40
|
# Raised if Cocina::Models::*WithMetadata not provided.
|
38
41
|
raise ArgumentError, 'ETag not provided.' unless skip_lock || params.respond_to?(:lock)
|
39
42
|
|
@@ -42,7 +45,7 @@ module Dor
|
|
42
45
|
req.headers['Content-Type'] = 'application/json'
|
43
46
|
# asking the service to return JSON (else it'll be plain text)
|
44
47
|
req.headers['Accept'] = 'application/json'
|
45
|
-
req.headers['If-Match'] = params
|
48
|
+
req.headers['If-Match'] = params.lock unless skip_lock
|
46
49
|
req.body = build_json_from_cocina(params)
|
47
50
|
end
|
48
51
|
|
@@ -51,6 +54,7 @@ module Dor
|
|
51
54
|
build_cocina_from_response(resp)
|
52
55
|
end
|
53
56
|
# rubocop:enable Metrics/AbcSize
|
57
|
+
# rubocop:enable Metrics/MethodLength
|
54
58
|
|
55
59
|
# Pull in metadata from Symphony and updates descriptive metadata
|
56
60
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
@@ -53,15 +53,19 @@ module Dor
|
|
53
53
|
|
54
54
|
# Open new version for an object
|
55
55
|
# @param params [Hash] optional params (see dor-services-app)
|
56
|
-
# @raise [MalformedResponse] when the response is not parseable.
|
57
56
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
58
57
|
# @raise [UnexpectedResponse] when the response is not successful.
|
59
|
-
# @return [
|
58
|
+
# @return [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata] cocina model with updated version
|
60
59
|
def open(**params)
|
61
|
-
|
62
|
-
|
60
|
+
resp = connection.post do |req|
|
61
|
+
req.url open_new_version_path
|
62
|
+
req.headers['Content-Type'] = 'application/json'
|
63
|
+
req.body = params.to_json if params.any?
|
64
|
+
end
|
63
65
|
|
64
|
-
|
66
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
67
|
+
|
68
|
+
build_cocina_from_response(resp)
|
65
69
|
end
|
66
70
|
|
67
71
|
# Close current version for an object
|
@@ -99,22 +103,6 @@ module Dor
|
|
99
103
|
"#{api_version}/objects/#{object_identifier}"
|
100
104
|
end
|
101
105
|
|
102
|
-
# Make request to server to open a new version
|
103
|
-
# @param params [Hash] optional params (see dor-services-app)
|
104
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
105
|
-
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
106
|
-
# @return [String] the plain text from the server
|
107
|
-
def open_new_version_response(**params)
|
108
|
-
resp = connection.post do |req|
|
109
|
-
req.url open_new_version_path
|
110
|
-
req.headers['Content-Type'] = 'application/json'
|
111
|
-
req.body = params.to_json if params.any?
|
112
|
-
end
|
113
|
-
return resp.body if resp.success?
|
114
|
-
|
115
|
-
raise_exception_based_on_response!(resp)
|
116
|
-
end
|
117
|
-
|
118
106
|
def base_path
|
119
107
|
"#{object_path}/versions"
|
120
108
|
end
|
@@ -8,9 +8,9 @@ module Dor
|
|
8
8
|
# API calls that are about a repository objects
|
9
9
|
class Objects < VersionedService
|
10
10
|
# Creates a new object in DOR
|
11
|
-
# @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::
|
11
|
+
# @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAdminPolicy]
|
12
12
|
# @param assign_doi [Boolean]
|
13
|
-
# @return [Cocina::Models::
|
13
|
+
# @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
|
14
14
|
def register(params:, assign_doi: false)
|
15
15
|
resp = connection.post do |req|
|
16
16
|
req.url "#{api_version}/objects"
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.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
12
|
date: 2022-04-21 00:00:00.000000000 Z
|
@@ -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.1.4
|
284
|
+
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: A client for dor-services-app
|
287
287
|
test_files: []
|