dor-services-client 15.19.3 → 15.21.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 +25 -25
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/mutate.rb +1 -1
- data/lib/dor/services/client/object.rb +1 -1
- data/lib/dor/services/client/object_version.rb +2 -2
- data/lib/dor/services/client/objects.rb +20 -3
- data/lib/dor/services/client/user_version.rb +1 -1
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/versioned_service.rb +8 -6
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6536e1ca0e1c9bb42fc69089309167393a6c6f530d5b1e3230a3994ceaf7439
|
4
|
+
data.tar.gz: d34390bd76707a2b5a7cb81b16d27e9db4630064f282d42ad75ee708c3f4f5bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d5ea3b5c73fb022acb8c8e1c7234d50dea162c3c38b2bb480e2397de5c832f8a96306b396f3313ceff92bb2994a922911a48351003bc9b3abaf17eae278a18b
|
7
|
+
data.tar.gz: fb93d6b764391c307e3473a57b394df7bf620b7866d58d44d490ef029cb3d3acaab86120a419296a5f637e850ac216d6cae84b481086798d219e26e25dcbb979
|
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.21.0)
|
5
5
|
activesupport (>= 7.0.0)
|
6
|
-
cocina-models (~> 0.
|
6
|
+
cocina-models (~> 0.106.0)
|
7
7
|
deprecation
|
8
8
|
faraday (~> 2.0)
|
9
9
|
faraday-retry
|
@@ -13,7 +13,7 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activesupport (8.0.
|
16
|
+
activesupport (8.0.3)
|
17
17
|
base64
|
18
18
|
benchmark (>= 0.3)
|
19
19
|
bigdecimal
|
@@ -32,9 +32,9 @@ GEM
|
|
32
32
|
attr_extras (7.1.0)
|
33
33
|
base64 (0.3.0)
|
34
34
|
benchmark (0.4.1)
|
35
|
-
bigdecimal (3.2.
|
35
|
+
bigdecimal (3.2.3)
|
36
36
|
byebug (12.0.0)
|
37
|
-
cocina-models (0.
|
37
|
+
cocina-models (0.106.0)
|
38
38
|
activesupport
|
39
39
|
deprecation
|
40
40
|
dry-struct (~> 1.0)
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
thor
|
50
50
|
zeitwerk (~> 2.1)
|
51
51
|
concurrent-ruby (1.3.5)
|
52
|
-
connection_pool (2.5.
|
52
|
+
connection_pool (2.5.4)
|
53
53
|
crack (1.0.0)
|
54
54
|
bigdecimal
|
55
55
|
rexml
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
activesupport (>= 3.0, < 9.0)
|
85
85
|
equivalent-xml (0.6.0)
|
86
86
|
nokogiri (>= 1.4.3)
|
87
|
-
faraday (2.
|
87
|
+
faraday (2.14.0)
|
88
88
|
faraday-net_http (>= 2.0, < 3.5)
|
89
89
|
json
|
90
90
|
logger
|
@@ -92,11 +92,11 @@ GEM
|
|
92
92
|
net-http (>= 0.5.0)
|
93
93
|
faraday-retry (2.3.2)
|
94
94
|
faraday (~> 2.0)
|
95
|
-
hashdiff (1.2.
|
95
|
+
hashdiff (1.2.1)
|
96
96
|
i18n (1.14.7)
|
97
97
|
concurrent-ruby (~> 1.0)
|
98
98
|
ice_nine (0.11.2)
|
99
|
-
json (2.
|
99
|
+
json (2.15.0)
|
100
100
|
jsonpath (1.1.5)
|
101
101
|
multi_json
|
102
102
|
language_server-protocol (3.17.0.5)
|
@@ -106,27 +106,27 @@ GEM
|
|
106
106
|
multi_json (1.17.0)
|
107
107
|
net-http (0.6.0)
|
108
108
|
uri
|
109
|
-
nokogiri (1.18.
|
109
|
+
nokogiri (1.18.10-arm64-darwin)
|
110
110
|
racc (~> 1.4)
|
111
|
-
nokogiri (1.18.
|
111
|
+
nokogiri (1.18.10-x86_64-darwin)
|
112
112
|
racc (~> 1.4)
|
113
|
-
nokogiri (1.18.
|
113
|
+
nokogiri (1.18.10-x86_64-linux-gnu)
|
114
114
|
racc (~> 1.4)
|
115
115
|
openapi_parser (1.0.0)
|
116
116
|
optimist (3.2.1)
|
117
117
|
parallel (1.27.0)
|
118
|
-
parser (3.3.
|
118
|
+
parser (3.3.9.0)
|
119
119
|
ast (~> 2.4.1)
|
120
120
|
racc
|
121
121
|
patience_diff (1.2.0)
|
122
122
|
optimist (~> 3.0)
|
123
|
-
prism (1.
|
123
|
+
prism (1.5.1)
|
124
124
|
public_suffix (6.0.2)
|
125
125
|
racc (1.8.1)
|
126
126
|
rainbow (3.1.1)
|
127
127
|
rake (13.3.0)
|
128
|
-
regexp_parser (2.
|
129
|
-
rexml (3.4.
|
128
|
+
regexp_parser (2.11.3)
|
129
|
+
rexml (3.4.4)
|
130
130
|
rspec (3.13.1)
|
131
131
|
rspec-core (~> 3.13.0)
|
132
132
|
rspec-expectations (~> 3.13.0)
|
@@ -139,8 +139,8 @@ GEM
|
|
139
139
|
rspec-mocks (3.13.5)
|
140
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
141
141
|
rspec-support (~> 3.13.0)
|
142
|
-
rspec-support (3.13.
|
143
|
-
rubocop (1.
|
142
|
+
rspec-support (3.13.6)
|
143
|
+
rubocop (1.81.1)
|
144
144
|
json (~> 2.3)
|
145
145
|
language_server-protocol (~> 3.17.0.2)
|
146
146
|
lint_roller (~> 1.1.0)
|
@@ -148,13 +148,13 @@ GEM
|
|
148
148
|
parser (>= 3.3.0.2)
|
149
149
|
rainbow (>= 2.2.2, < 4.0)
|
150
150
|
regexp_parser (>= 2.9.3, < 3.0)
|
151
|
-
rubocop-ast (>= 1.
|
151
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
152
152
|
ruby-progressbar (~> 1.7)
|
153
153
|
unicode-display_width (>= 2.4.0, < 4.0)
|
154
|
-
rubocop-ast (1.
|
154
|
+
rubocop-ast (1.47.1)
|
155
155
|
parser (>= 3.3.7.2)
|
156
156
|
prism (~> 1.4)
|
157
|
-
rubocop-rspec (3.
|
157
|
+
rubocop-rspec (3.7.0)
|
158
158
|
lint_roller (~> 1.1)
|
159
159
|
rubocop (~> 1.72, >= 1.72.1)
|
160
160
|
ruby-progressbar (1.13.0)
|
@@ -172,9 +172,9 @@ GEM
|
|
172
172
|
thor (1.4.0)
|
173
173
|
tzinfo (2.0.6)
|
174
174
|
concurrent-ruby (~> 1.0)
|
175
|
-
unicode-display_width (3.
|
176
|
-
unicode-emoji (~> 4.
|
177
|
-
unicode-emoji (4.0
|
175
|
+
unicode-display_width (3.2.0)
|
176
|
+
unicode-emoji (~> 4.1)
|
177
|
+
unicode-emoji (4.1.0)
|
178
178
|
uri (1.0.3)
|
179
179
|
webmock (3.25.1)
|
180
180
|
addressable (>= 2.8.0)
|
@@ -203,4 +203,4 @@ DEPENDENCIES
|
|
203
203
|
webmock
|
204
204
|
|
205
205
|
BUNDLED WITH
|
206
|
-
2.7.
|
206
|
+
2.7.2
|
data/dor-services-client.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '>= 3.0', '< 4'
|
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.106.0'
|
29
29
|
spec.add_dependency 'deprecation', '>= 0'
|
30
30
|
spec.add_dependency 'faraday', '~> 2.0'
|
31
31
|
spec.add_dependency 'faraday-retry'
|
@@ -55,7 +55,7 @@ module Dor
|
|
55
55
|
|
56
56
|
raise_exception_based_on_response!(resp) unless resp.success?
|
57
57
|
|
58
|
-
build_cocina_from_response(resp, validate: validate)
|
58
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: validate)
|
59
59
|
end
|
60
60
|
# rubocop:enable Metrics/AbcSize
|
61
61
|
# rubocop:enable Metrics/MethodLength
|
@@ -76,7 +76,7 @@ module Dor
|
|
76
76
|
end
|
77
77
|
raise_exception_based_on_response!(resp) unless resp.success?
|
78
78
|
|
79
|
-
build_cocina_from_response(resp, validate: validate)
|
79
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: validate)
|
80
80
|
end
|
81
81
|
|
82
82
|
BASE_ALLOWED_FIELDS = %i[external_identifier cocina_version label version administrative description].freeze
|
@@ -61,7 +61,7 @@ module Dor
|
|
61
61
|
end
|
62
62
|
raise_exception_based_on_response!(resp) unless resp.success?
|
63
63
|
|
64
|
-
build_cocina_from_response(resp, validate: false)
|
64
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: false)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Get the current version for a DOR object. This comes from ObjectVersion table in the DSA
|
@@ -93,7 +93,7 @@ module Dor
|
|
93
93
|
|
94
94
|
raise_exception_based_on_response!(resp) unless resp.success?
|
95
95
|
|
96
|
-
build_cocina_from_response(resp)
|
96
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers)
|
97
97
|
end
|
98
98
|
|
99
99
|
# Close current version for an object
|
@@ -13,7 +13,7 @@ module Dor
|
|
13
13
|
# @param [string] user_name the sunetid of the user registering the object
|
14
14
|
# @param [boolean] validate validate the response object
|
15
15
|
# @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
|
16
|
-
def register(params:, assign_doi: false, validate: false, user_name: nil)
|
16
|
+
def register(params:, assign_doi: false, validate: false, user_name: nil) # rubocop:disable Metrics/AbcSize
|
17
17
|
resp = connection.post do |req|
|
18
18
|
req.url objects_path
|
19
19
|
req.params = { assign_doi: assign_doi, user_name: user_name }.compact
|
@@ -25,7 +25,7 @@ module Dor
|
|
25
25
|
|
26
26
|
raise_exception_based_on_response!(resp) unless resp.success?
|
27
27
|
|
28
|
-
build_cocina_from_response(resp, validate: validate)
|
28
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: validate)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Find an object by source ID
|
@@ -40,7 +40,24 @@ module Dor
|
|
40
40
|
end
|
41
41
|
raise_exception_based_on_response!(resp) unless resp.success?
|
42
42
|
|
43
|
-
build_cocina_from_response(resp, validate: validate)
|
43
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: validate)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Find objects by a list of druids
|
47
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
48
|
+
# @return [Array<Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,,Cocina::Models::AdminPolicyWithMetadata>] the returned objects
|
49
|
+
def find_all(druids:, validate: false)
|
50
|
+
resp = connection.post do |req|
|
51
|
+
req.url "#{objects_path}/find_all"
|
52
|
+
req.headers['Content-Type'] = 'application/json'
|
53
|
+
req.body = { 'externalIdentifiers' => druids }.to_json
|
54
|
+
end
|
55
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
56
|
+
|
57
|
+
JSON.parse(resp.body).map do |item|
|
58
|
+
# The ETag header is used as the lock parameter when instantiating a cocina model with metadata
|
59
|
+
build_cocina_from_response(item, headers: { 'ETag' => item['lock'] }, validate: validate)
|
60
|
+
end
|
44
61
|
end
|
45
62
|
|
46
63
|
# Retrieves the version statuses for a batch of objects
|
@@ -44,7 +44,7 @@ module Dor
|
|
44
44
|
end
|
45
45
|
raise_exception_based_on_response!(resp) unless resp.success?
|
46
46
|
|
47
|
-
build_cocina_from_response(resp, validate: false)
|
47
|
+
build_cocina_from_response(JSON.parse(resp.body), headers: resp.headers, validate: false)
|
48
48
|
end
|
49
49
|
|
50
50
|
# @return [Hash] the solr document for the user version
|
@@ -41,18 +41,20 @@ module Dor
|
|
41
41
|
errors: data.fetch('errors', []))
|
42
42
|
end
|
43
43
|
|
44
|
-
def build_cocina_from_response(
|
45
|
-
cocina_object = Cocina::Models.build(
|
46
|
-
Cocina::Models.
|
47
|
-
|
44
|
+
def build_cocina_from_response(item, headers: nil, validate: false)
|
45
|
+
cocina_object = Cocina::Models.build(item, validate: validate)
|
46
|
+
return Cocina::Models.without_metadata(cocina_object) unless headers.present?
|
47
|
+
|
48
|
+
Cocina::Models.with_metadata(cocina_object, headers['ETag'], created: date_from_header(headers, 'X-Created-At'),
|
49
|
+
modified: date_from_header(headers, 'Last-Modified'))
|
48
50
|
end
|
49
51
|
|
50
52
|
def build_json_from_cocina(cocina_object)
|
51
53
|
Cocina::Models.without_metadata(cocina_object).to_json
|
52
54
|
end
|
53
55
|
|
54
|
-
def date_from_header(
|
55
|
-
|
56
|
+
def date_from_header(headers, key)
|
57
|
+
headers[key]&.to_datetime
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
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.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
- Michael Giarlo
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
@@ -31,14 +30,14 @@ dependencies:
|
|
31
30
|
requirements:
|
32
31
|
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
33
|
+
version: 0.106.0
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
40
|
+
version: 0.106.0
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: deprecation
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +220,6 @@ dependencies:
|
|
221
220
|
- - ">="
|
222
221
|
- !ruby/object:Gem::Version
|
223
222
|
version: '0'
|
224
|
-
description:
|
225
223
|
email:
|
226
224
|
- jcoyne@justincoyne.com
|
227
225
|
- leftwing@alumni.rutgers.edu
|
@@ -277,7 +275,6 @@ homepage: https://github.com/sul-dlss/dor-services-client
|
|
277
275
|
licenses: []
|
278
276
|
metadata:
|
279
277
|
rubygems_mfa_required: 'true'
|
280
|
-
post_install_message:
|
281
278
|
rdoc_options: []
|
282
279
|
require_paths:
|
283
280
|
- lib
|
@@ -295,8 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
292
|
- !ruby/object:Gem::Version
|
296
293
|
version: '0'
|
297
294
|
requirements: []
|
298
|
-
rubygems_version: 3.
|
299
|
-
signing_key:
|
295
|
+
rubygems_version: 3.7.2
|
300
296
|
specification_version: 4
|
301
297
|
summary: A client for dor-services-app
|
302
298
|
test_files: []
|