dor-services-client 15.30.1 → 15.32.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/Gemfile.lock +15 -8
- data/README.md +2 -0
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/object_version.rb +10 -4
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/versioned_service.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '06370387f51516d2a08d643598cc2e885f783014aa3bcb4f353abd131372470e'
|
|
4
|
+
data.tar.gz: 218e00a0664bb35a8ce93677791f6c5d6c52ffb64e3eb23a88da2713a4e79ee6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37fc5d5a48b56cfa1bab49622d8c63014776f6493252ca7c69d63605296c8b4a60ea4739f0cb9205989a81a6ff37e800b965ba8cf6e35fb9a9f0211719f96ac3
|
|
7
|
+
data.tar.gz: b25369fb1e80f33db2bfc03fb1135f470d882b0af2017b29a3f1342531d5d0c04c0c59f19a8c685519bd89f123b1a9803471204e42f0ad4dd28f6a5339ec9323
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
dor-services-client (15.
|
|
4
|
+
dor-services-client (15.32.0)
|
|
5
5
|
activesupport (>= 7.0.0)
|
|
6
|
-
cocina-models (~> 0.
|
|
6
|
+
cocina-models (~> 0.113.0)
|
|
7
7
|
deprecation
|
|
8
8
|
faraday (~> 2.0)
|
|
9
9
|
faraday-retry
|
|
@@ -26,7 +26,7 @@ GEM
|
|
|
26
26
|
securerandom (>= 0.3)
|
|
27
27
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
28
28
|
uri (>= 0.13.1)
|
|
29
|
-
addressable (2.8.
|
|
29
|
+
addressable (2.8.9)
|
|
30
30
|
public_suffix (>= 2.0.2, < 8.0)
|
|
31
31
|
ast (2.4.3)
|
|
32
32
|
attr_extras (7.1.0)
|
|
@@ -34,7 +34,7 @@ GEM
|
|
|
34
34
|
bigdecimal (4.0.1)
|
|
35
35
|
byebug (13.0.0)
|
|
36
36
|
reline (>= 0.6.0)
|
|
37
|
-
cocina-models (0.
|
|
37
|
+
cocina-models (0.113.0)
|
|
38
38
|
activesupport
|
|
39
39
|
deprecation
|
|
40
40
|
dry-struct (~> 1.0)
|
|
@@ -99,6 +99,9 @@ GEM
|
|
|
99
99
|
ice_nine (0.11.2)
|
|
100
100
|
io-console (0.8.2)
|
|
101
101
|
json (2.18.1)
|
|
102
|
+
json-schema (6.1.0)
|
|
103
|
+
addressable (~> 2.8)
|
|
104
|
+
bigdecimal (>= 3.1, < 5)
|
|
102
105
|
json_schemer (2.5.0)
|
|
103
106
|
bigdecimal
|
|
104
107
|
hana (~> 1.3)
|
|
@@ -109,7 +112,10 @@ GEM
|
|
|
109
112
|
language_server-protocol (3.17.0.5)
|
|
110
113
|
lint_roller (1.1.0)
|
|
111
114
|
logger (1.7.0)
|
|
112
|
-
|
|
115
|
+
mcp (0.7.1)
|
|
116
|
+
json-schema (>= 4.1)
|
|
117
|
+
minitest (6.0.2)
|
|
118
|
+
drb (~> 2.0)
|
|
113
119
|
prism (~> 1.5)
|
|
114
120
|
multi_json (1.19.1)
|
|
115
121
|
net-http (0.9.1)
|
|
@@ -145,14 +151,15 @@ GEM
|
|
|
145
151
|
rspec-expectations (3.13.5)
|
|
146
152
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
147
153
|
rspec-support (~> 3.13.0)
|
|
148
|
-
rspec-mocks (3.13.
|
|
154
|
+
rspec-mocks (3.13.8)
|
|
149
155
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
150
156
|
rspec-support (~> 3.13.0)
|
|
151
157
|
rspec-support (3.13.7)
|
|
152
|
-
rubocop (1.
|
|
158
|
+
rubocop (1.85.0)
|
|
153
159
|
json (~> 2.3)
|
|
154
160
|
language_server-protocol (~> 3.17.0.2)
|
|
155
161
|
lint_roller (~> 1.1.0)
|
|
162
|
+
mcp (~> 0.6)
|
|
156
163
|
parallel (~> 1.10)
|
|
157
164
|
parser (>= 3.3.0.2)
|
|
158
165
|
rainbow (>= 2.2.2, < 4.0)
|
|
@@ -214,4 +221,4 @@ DEPENDENCIES
|
|
|
214
221
|
webmock
|
|
215
222
|
|
|
216
223
|
BUNDLED WITH
|
|
217
|
-
4.0.
|
|
224
|
+
4.0.7
|
data/README.md
CHANGED
|
@@ -108,6 +108,8 @@ object_client.version.current
|
|
|
108
108
|
# Status includes whether the object is open, assembling, accessioning, or closeable.
|
|
109
109
|
# See also objects_client.statuses for getting statuses in batch.
|
|
110
110
|
object_client.version.status
|
|
111
|
+
# Returns object version as Cocina instance if valid; returns a Hash<cocina_object:, error_message:> if invalid
|
|
112
|
+
object_client.version.find(3)
|
|
111
113
|
|
|
112
114
|
# see dor-services-app openapi.yml for optional params
|
|
113
115
|
object_client.version.open(description: 'Changed title')
|
data/dor-services-client.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.required_ruby_version = '>= 3.0', '< 5'
|
|
26
26
|
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 7.0.0'
|
|
28
|
-
spec.add_dependency 'cocina-models', '~> 0.
|
|
28
|
+
spec.add_dependency 'cocina-models', '~> 0.113.0'
|
|
29
29
|
spec.add_dependency 'deprecation', '>= 0'
|
|
30
30
|
spec.add_dependency 'faraday', '~> 2.0'
|
|
31
31
|
spec.add_dependency 'faraday-retry'
|
|
@@ -53,15 +53,21 @@ module Dor
|
|
|
53
53
|
@object_identifier = object_identifier
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
# @return [Cocina::Models::DROWithMetadata] the object metadata
|
|
57
|
-
#
|
|
56
|
+
# @return [Cocina::Models::DROWithMetadata, Hash] the object metadata or a hash with
|
|
57
|
+
# invalid metadata and a message about the source of the invalidity
|
|
58
|
+
# @raise [Dor::Services::Client::Error] on an unsuccessful response from the server
|
|
58
59
|
def find(version)
|
|
59
60
|
resp = connection.get do |req|
|
|
60
61
|
req.url "#{base_path}/#{version}"
|
|
61
62
|
end
|
|
62
|
-
raise_exception_based_on_response!(resp) unless resp.success?
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
if resp.success?
|
|
65
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: false)
|
|
66
|
+
elsif resp.status == 409 # Signals the Cocina is present but invalid
|
|
67
|
+
build_invalid_cocina_from_response(resp)
|
|
68
|
+
else
|
|
69
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
|
70
|
+
end
|
|
65
71
|
end
|
|
66
72
|
|
|
67
73
|
# Get the current version for a DOR object. This comes from ObjectVersion table in the DSA
|
|
@@ -54,6 +54,15 @@ module Dor
|
|
|
54
54
|
Cocina::Models.without_metadata(cocina_object).to_json
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
def build_invalid_cocina_from_response(response)
|
|
58
|
+
invalid_cocina_error = JSON.parse(response.body).dig('errors', 0)
|
|
59
|
+
|
|
60
|
+
{
|
|
61
|
+
cocina_object: invalid_cocina_error.dig('meta', 'json'),
|
|
62
|
+
error_message: invalid_cocina_error['message']
|
|
63
|
+
}.with_indifferent_access
|
|
64
|
+
end
|
|
65
|
+
|
|
57
66
|
def date_from_header(headers, key)
|
|
58
67
|
headers[key]&.to_datetime
|
|
59
68
|
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: 15.
|
|
4
|
+
version: 15.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
33
|
+
version: 0.113.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
40
|
+
version: 0.113.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: deprecation
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|