dor-services-client 11.0.0 → 12.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 +4 -4
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/metadata.rb +0 -14
- data/lib/dor/services/client/mutate.rb +3 -2
- data/lib/dor/services/client/object.rb +3 -2
- data/lib/dor/services/client/objects.rb +3 -2
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/versioned_service.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d123cfe73a0981439bec1c66e49f10bb6dd5d0d43bebf72eebaede03f4ae6ae
|
4
|
+
data.tar.gz: 0f2f18cc38f22bca07062506662f0feaa1613e7179f4ab86379d3d60dca74394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45638215f8d33a565923e1c75368d649faa675bcd9491914b6d9fd73f5bb72ac9c2d3b9c32a2754ac6307545ed9ad88e85e05c298a3c141bafbe44defeae5ded
|
7
|
+
data.tar.gz: fddfd25949ecda8603982e4008321dce816dd2633d51db01c97de3b589c5341092c7fe90f3df164446ce85162c4ed8bb6a80dbbf33472ae4831b376ede539b29
|
data/dor-services-client.gemspec
CHANGED
@@ -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.
|
28
|
+
spec.add_dependency 'cocina-models', '~> 0.79.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
|
@@ -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
|
@@ -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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.0.0
|
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: 2022-05-
|
12
|
+
date: 2022-05-09 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.79.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.79.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: deprecation
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|