dor-services-client 15.20.0 → 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 +8 -8
- 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 +3 -3
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,7 +1,7 @@
|
|
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
6
|
cocina-models (~> 0.106.0)
|
7
7
|
deprecation
|
@@ -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
|
@@ -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
|
@@ -96,7 +96,7 @@ GEM
|
|
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)
|
@@ -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,10 +148,10 @@ 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
157
|
rubocop-rspec (3.7.0)
|
@@ -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,14 +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
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
version: '0'
|
294
294
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
295
|
+
rubygems_version: 3.7.2
|
296
296
|
specification_version: 4
|
297
297
|
summary: A client for dor-services-app
|
298
298
|
test_files: []
|