dor-services-client 15.1.0 → 15.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +68 -9
- data/Gemfile.lock +17 -14
- data/README.md +1 -24
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/object.rb +17 -46
- data/lib/dor/services/client/object_version.rb +17 -24
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/workspace.rb +0 -18
- metadata +5 -12
- data/lib/dor/services/client/transfer.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17084d47db10602abff0c9d6bc50840dfac58ac14e2efa96a2a2f38f0dd8b779
|
4
|
+
data.tar.gz: 9fa643be94ed39a305199becf67b996759084fbf2ebecbd139cfc2e03b50c6ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fedc3d9668ecc6be0e9139b983ce5ee4469572250c3e354b7152047f27f88c52d2c90f2147aadf72de3b63402a0e23db4b8555f60f8693380e37a72301e01686
|
7
|
+
data.tar.gz: 47af1f97d1969b053b64ad9b7a634192e0efaf103e5add43d949cc6c1c7a4f45a41caf9f72ad09d207c5ac193f918acd28a0375153d249050d1c8e0d4b8028b0
|
data/.rubocop.yml
CHANGED
@@ -12,15 +12,15 @@ Metrics/BlockLength:
|
|
12
12
|
- 'dor-services-client.gemspec'
|
13
13
|
- 'spec/**/*'
|
14
14
|
|
15
|
+
RSpec/ExampleLength:
|
16
|
+
Enabled: false
|
17
|
+
|
15
18
|
RSpec/MultipleExpectations:
|
16
19
|
Enabled: false
|
17
20
|
|
18
21
|
RSpec/MultipleMemoizedHelpers:
|
19
22
|
Enabled: false
|
20
23
|
|
21
|
-
RSpec/ExampleLength:
|
22
|
-
Max: 10
|
23
|
-
|
24
24
|
Gemspec/DeprecatedAttributeAssignment: # (new in 1.10)
|
25
25
|
Enabled: true
|
26
26
|
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
@@ -135,7 +135,7 @@ RSpec/SubjectDeclaration: # new in 2.5
|
|
135
135
|
Enabled: true
|
136
136
|
FactoryBot/SyntaxMethods: # new in 2.7
|
137
137
|
Enabled: true
|
138
|
-
|
138
|
+
RSpecRails/AvoidSetupHook: # new in 2.4
|
139
139
|
Enabled: true
|
140
140
|
|
141
141
|
Lint/RefinementImportMethods: # new in 1.27
|
@@ -179,7 +179,7 @@ RSpec/ChangeByZero: # new in 2.11.0
|
|
179
179
|
Enabled: true
|
180
180
|
Capybara/SpecificMatcher: # new in 2.12
|
181
181
|
Enabled: false
|
182
|
-
|
182
|
+
RSpecRails/HaveHttpStatus: # new in 2.12
|
183
183
|
Enabled: false
|
184
184
|
|
185
185
|
RSpec/ClassCheck: # new in 2.13
|
@@ -271,11 +271,11 @@ RSpec/SkipBlockInsideExample: # new in 2.19
|
|
271
271
|
Enabled: true
|
272
272
|
RSpec/SortMetadata: # new in 2.14
|
273
273
|
Enabled: true
|
274
|
-
|
274
|
+
RSpecRails/InferredSpecType: # new in 2.14
|
275
275
|
Enabled: true
|
276
|
-
|
276
|
+
RSpecRails/MinitestAssertions: # new in 2.17
|
277
277
|
Enabled: true
|
278
|
-
|
278
|
+
RSpecRails/TravelAround: # new in 2.19
|
279
279
|
Enabled: true
|
280
280
|
|
281
281
|
Lint/MixedCaseRange: # new in 1.53
|
@@ -292,5 +292,64 @@ Style/YAMLFileRead: # new in 1.53
|
|
292
292
|
Enabled: true
|
293
293
|
RSpec/ReceiveMessages: # new in 2.23
|
294
294
|
Enabled: true
|
295
|
-
|
295
|
+
RSpecRails/NegationBeValid: # new in 2.23
|
296
|
+
Enabled: true
|
297
|
+
|
298
|
+
Gemspec/AddRuntimeDependency: # new in 1.65
|
299
|
+
Enabled: true
|
300
|
+
Lint/DuplicateSetElement: # new in 1.67
|
301
|
+
Enabled: true
|
302
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
303
|
+
Enabled: true
|
304
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
305
|
+
Enabled: true
|
306
|
+
Lint/UselessNumericOperation: # new in 1.66
|
307
|
+
Enabled: true
|
308
|
+
Style/MapIntoArray: # new in 1.63
|
309
|
+
Enabled: true
|
310
|
+
Style/RedundantInterpolationUnfreeze: # new in 1.66
|
311
|
+
Enabled: true
|
312
|
+
Style/SendWithLiteralMethodName: # new in 1.64
|
313
|
+
Enabled: true
|
314
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
315
|
+
Enabled: true
|
316
|
+
Style/SuperArguments: # new in 1.64
|
317
|
+
Enabled: true
|
318
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
319
|
+
Enabled: true
|
320
|
+
Capybara/ClickLinkOrButtonStyle: # new in 2.19
|
321
|
+
Enabled: true
|
322
|
+
Capybara/RedundantWithinFind: # new in 2.20
|
323
|
+
Enabled: true
|
324
|
+
Capybara/RSpec/HaveSelector: # new in 2.19
|
325
|
+
Enabled: true
|
326
|
+
Capybara/RSpec/PredicateMatcher: # new in 2.19
|
327
|
+
Enabled: true
|
328
|
+
FactoryBot/ExcessiveCreateList: # new in 2.25
|
329
|
+
Enabled: true
|
330
|
+
FactoryBot/IdSequence: # new in 2.24
|
331
|
+
Enabled: true
|
332
|
+
RSpec/EmptyMetadata: # new in 2.24
|
333
|
+
Enabled: true
|
334
|
+
RSpec/EmptyOutput: # new in 2.29
|
335
|
+
Enabled: true
|
336
|
+
RSpec/Eq: # new in 2.24
|
337
|
+
Enabled: true
|
338
|
+
RSpec/ExpectInLet: # new in 2.30
|
339
|
+
Enabled: true
|
340
|
+
RSpec/IsExpectedSpecify: # new in 2.27
|
341
|
+
Enabled: true
|
342
|
+
RSpec/MetadataStyle: # new in 2.24
|
343
|
+
Enabled: true
|
344
|
+
RSpec/RedundantPredicateMatcher: # new in 2.26
|
345
|
+
Enabled: true
|
346
|
+
RSpec/RemoveConst: # new in 2.26
|
347
|
+
Enabled: true
|
348
|
+
RSpec/RepeatedSubjectCall: # new in 2.27
|
349
|
+
Enabled: true
|
350
|
+
RSpec/SpecFilePathFormat: # new in 2.24
|
351
|
+
Enabled: true
|
352
|
+
RSpec/SpecFilePathSuffix: # new in 2.24
|
353
|
+
Enabled: true
|
354
|
+
RSpec/UndescriptiveLiteralsDescription: # new in 2.29
|
296
355
|
Enabled: true
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dor-services-client (15.1
|
5
|
-
activesupport (>=
|
4
|
+
dor-services-client (15.2.1)
|
5
|
+
activesupport (>= 7.0.0)
|
6
6
|
cocina-models (~> 0.99.0)
|
7
7
|
deprecation
|
8
8
|
faraday (~> 2.0)
|
@@ -12,8 +12,9 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (7.2.
|
15
|
+
activesupport (7.2.2)
|
16
16
|
base64
|
17
|
+
benchmark (>= 0.3)
|
17
18
|
bigdecimal
|
18
19
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
19
20
|
connection_pool (>= 2.2.5)
|
@@ -28,6 +29,7 @@ GEM
|
|
28
29
|
ast (2.4.2)
|
29
30
|
attr_extras (7.1.0)
|
30
31
|
base64 (0.2.0)
|
32
|
+
benchmark (0.4.0)
|
31
33
|
bigdecimal (3.1.8)
|
32
34
|
byebug (11.1.3)
|
33
35
|
cocina-models (0.99.0)
|
@@ -58,8 +60,9 @@ GEM
|
|
58
60
|
diff-lcs (1.5.1)
|
59
61
|
docile (1.4.1)
|
60
62
|
drb (2.2.1)
|
61
|
-
dry-core (1.0.
|
63
|
+
dry-core (1.0.2)
|
62
64
|
concurrent-ruby (~> 1.0)
|
65
|
+
logger
|
63
66
|
zeitwerk (~> 2.6)
|
64
67
|
dry-inflector (1.1.0)
|
65
68
|
dry-logic (1.5.0)
|
@@ -94,14 +97,14 @@ GEM
|
|
94
97
|
i18n (1.14.6)
|
95
98
|
concurrent-ruby (~> 1.0)
|
96
99
|
ice_nine (0.11.2)
|
97
|
-
json (2.
|
100
|
+
json (2.8.1)
|
98
101
|
jsonpath (1.1.5)
|
99
102
|
multi_json
|
100
103
|
language_server-protocol (3.17.0.3)
|
101
104
|
logger (1.6.1)
|
102
105
|
minitest (5.25.1)
|
103
106
|
multi_json (1.15.0)
|
104
|
-
net-http (0.
|
107
|
+
net-http (0.5.0)
|
105
108
|
uri
|
106
109
|
nokogiri (1.16.7-arm64-darwin)
|
107
110
|
racc (~> 1.4)
|
@@ -114,7 +117,7 @@ GEM
|
|
114
117
|
openapi_parser (1.0.0)
|
115
118
|
optimist (3.1.0)
|
116
119
|
parallel (1.26.3)
|
117
|
-
parser (3.3.
|
120
|
+
parser (3.3.6.0)
|
118
121
|
ast (~> 2.4.1)
|
119
122
|
racc
|
120
123
|
patience_diff (1.2.0)
|
@@ -124,12 +127,12 @@ GEM
|
|
124
127
|
rainbow (3.1.1)
|
125
128
|
rake (13.2.1)
|
126
129
|
regexp_parser (2.9.2)
|
127
|
-
rexml (3.3.
|
130
|
+
rexml (3.3.9)
|
128
131
|
rspec (3.13.0)
|
129
132
|
rspec-core (~> 3.13.0)
|
130
133
|
rspec-expectations (~> 3.13.0)
|
131
134
|
rspec-mocks (~> 3.13.0)
|
132
|
-
rspec-core (3.13.
|
135
|
+
rspec-core (3.13.2)
|
133
136
|
rspec-support (~> 3.13.0)
|
134
137
|
rspec-expectations (3.13.3)
|
135
138
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -138,7 +141,7 @@ GEM
|
|
138
141
|
diff-lcs (>= 1.2.0, < 2.0)
|
139
142
|
rspec-support (~> 3.13.0)
|
140
143
|
rspec-support (3.13.1)
|
141
|
-
rubocop (1.
|
144
|
+
rubocop (1.68.0)
|
142
145
|
json (~> 2.3)
|
143
146
|
language_server-protocol (>= 3.17.0)
|
144
147
|
parallel (~> 1.10)
|
@@ -148,7 +151,7 @@ GEM
|
|
148
151
|
rubocop-ast (>= 1.32.2, < 2.0)
|
149
152
|
ruby-progressbar (~> 1.7)
|
150
153
|
unicode-display_width (>= 2.4.0, < 3.0)
|
151
|
-
rubocop-ast (1.
|
154
|
+
rubocop-ast (1.34.1)
|
152
155
|
parser (>= 3.3.1.0)
|
153
156
|
rubocop-capybara (2.21.0)
|
154
157
|
rubocop (~> 1.41)
|
@@ -162,7 +165,7 @@ GEM
|
|
162
165
|
rubocop-rspec_rails (2.29.1)
|
163
166
|
rubocop (~> 1.61)
|
164
167
|
ruby-progressbar (1.13.0)
|
165
|
-
securerandom (0.3.
|
168
|
+
securerandom (0.3.2)
|
166
169
|
simplecov (0.22.0)
|
167
170
|
docile (~> 1.1)
|
168
171
|
simplecov-html (~> 0.11)
|
@@ -177,12 +180,12 @@ GEM
|
|
177
180
|
tzinfo (2.0.6)
|
178
181
|
concurrent-ruby (~> 1.0)
|
179
182
|
unicode-display_width (2.6.0)
|
180
|
-
uri (0.
|
183
|
+
uri (1.0.1)
|
181
184
|
webmock (3.24.0)
|
182
185
|
addressable (>= 2.8.0)
|
183
186
|
crack (>= 0.3.2)
|
184
187
|
hashdiff (>= 0.4.0, < 2.0.0)
|
185
|
-
zeitwerk (2.
|
188
|
+
zeitwerk (2.7.1)
|
186
189
|
|
187
190
|
PLATFORMS
|
188
191
|
arm64-darwin-23
|
data/README.md
CHANGED
@@ -87,43 +87,21 @@ object_client.update(params: dro)
|
|
87
87
|
# Publish an object (push to PURL)
|
88
88
|
object_client.publish(workflow: 'releaseWF', lane_id: 'low')
|
89
89
|
|
90
|
-
# Unpublish an object (yank from PURL)
|
91
|
-
object_client.unpublish()
|
92
|
-
|
93
|
-
# Shelve an object (push to Stacks)
|
94
|
-
object_client.shelve(lane_id: 'low')
|
95
|
-
|
96
90
|
# Start accessioning an object (initialize assemblyWF or specified workflow, and version object if needed)
|
97
91
|
object_client.accession.start(**versioning_params)
|
98
92
|
|
99
|
-
# Preserve an object (push to SDR)
|
100
|
-
object_client.preserve(lane_id: 'low')
|
101
|
-
|
102
|
-
# Update the MARC record (used in the releaseWF)
|
103
|
-
object_client.update_marc_record
|
104
|
-
|
105
|
-
# Update the DOI metadata (used by robot)
|
106
|
-
object_client.update_doi_metadata
|
107
|
-
|
108
|
-
# Update the Orcid work (used by robot)
|
109
|
-
object_client.update_orcid_work
|
110
|
-
|
111
93
|
# Copy metadata from Symphony into descMetadata
|
112
94
|
object_client.refresh_descriptive_metadata_from_ils
|
113
95
|
|
114
96
|
# Apply defaults from the item's AdminPolicy to the item itself
|
115
97
|
object_client.apply_admin_policy_defaults
|
116
98
|
|
117
|
-
# Send a notification to goobi
|
118
|
-
object_client.notify_goobi
|
119
|
-
|
120
99
|
# Manage versions
|
121
100
|
object_client.version.inventory
|
122
101
|
object_client.version.current
|
123
102
|
# Returns a struct containing the status.
|
124
103
|
# Status includes whether the object is open, assembling, accessioning, or closeable.
|
125
104
|
object_client.version.status
|
126
|
-
object_client.version.openable?
|
127
105
|
# see dor-services-app openapi.yml for optional params
|
128
106
|
object_client.version.open(description: 'Changed title')
|
129
107
|
# see dor-services-app openapi.yml for optional params
|
@@ -164,9 +142,8 @@ object_client.release_tags.list(public: true) # only public release tags (i.e. l
|
|
164
142
|
object_client.events.create(type: type, data: data)
|
165
143
|
object_client.events.list
|
166
144
|
|
167
|
-
# Create
|
145
|
+
# Create workspaces
|
168
146
|
object_client.workspace.create(source: object_path_string)
|
169
|
-
object_client.workspace.cleanup
|
170
147
|
|
171
148
|
# Reindex
|
172
149
|
object_client.reindex
|
data/dor-services-client.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 3.0', '< 4'
|
26
26
|
|
27
|
-
spec.add_dependency 'activesupport', '>=
|
27
|
+
spec.add_dependency 'activesupport', '>= 7.0.0'
|
28
28
|
spec.add_dependency 'cocina-models', '~> 0.99.0'
|
29
29
|
spec.add_dependency 'deprecation', '>= 0'
|
30
30
|
spec.add_dependency 'faraday', '~> 2.0'
|
@@ -107,8 +107,6 @@ module Dor
|
|
107
107
|
Transfer.new(**parent_params)
|
108
108
|
end
|
109
109
|
|
110
|
-
delegate :publish, :unpublish, :preserve, :shelve, to: :transfer
|
111
|
-
|
112
110
|
def mutate
|
113
111
|
Mutate.new(**parent_params)
|
114
112
|
end
|
@@ -118,68 +116,41 @@ module Dor
|
|
118
116
|
alias refresh_metadata refresh_descriptive_metadata_from_ils
|
119
117
|
deprecation_deprecate refresh_metadata: 'Use refresh_descriptive_metadata_from_ils instead'
|
120
118
|
|
121
|
-
#
|
119
|
+
# Reindex the object in Solr.
|
122
120
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
123
121
|
# @raise [UnexpectedResponse] when the response is not successful.
|
124
122
|
# @return [boolean] true on success
|
125
|
-
def
|
126
|
-
resp = connection.post do |req|
|
127
|
-
req.url "#{object_path}/update_marc_record"
|
128
|
-
end
|
129
|
-
return true if resp.success?
|
130
|
-
|
131
|
-
raise_exception_based_on_response!(resp)
|
132
|
-
end
|
133
|
-
|
134
|
-
# Update the DOI metadata at DataCite
|
135
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
136
|
-
# @return [boolean] true on success
|
137
|
-
def update_doi_metadata
|
138
|
-
resp = connection.post do |req|
|
139
|
-
req.url "#{object_path}/update_doi_metadata"
|
140
|
-
end
|
141
|
-
return true if resp.success?
|
142
|
-
|
143
|
-
raise_exception_based_on_response!(resp)
|
144
|
-
end
|
145
|
-
|
146
|
-
# Update the ORCID Work
|
147
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
148
|
-
# @return [Boolean] true on success
|
149
|
-
def update_orcid_work
|
123
|
+
def reindex
|
150
124
|
resp = connection.post do |req|
|
151
|
-
req.url "#{object_path}/
|
125
|
+
req.url "#{object_path}/reindex"
|
152
126
|
end
|
153
127
|
return true if resp.success?
|
154
128
|
|
155
129
|
raise_exception_based_on_response!(resp)
|
156
130
|
end
|
157
131
|
|
158
|
-
#
|
132
|
+
# Publish an object (send to PURL)
|
159
133
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
160
134
|
# @raise [UnexpectedResponse] when the response is not successful.
|
161
|
-
# @
|
162
|
-
|
163
|
-
|
164
|
-
|
135
|
+
# @param [String] workflow (nil) which workflow to callback to.
|
136
|
+
# @param [String] lane_id for prioritization (default or low)
|
137
|
+
# @return [String] the URL of the background job on dor-service-app
|
138
|
+
# rubocop:disable Metrics/MethodLength
|
139
|
+
def publish(workflow: nil, lane_id: nil)
|
140
|
+
query_params = [].tap do |params|
|
141
|
+
params << "workflow=#{workflow}" if workflow
|
142
|
+
params << "lane-id=#{lane_id}" if lane_id
|
165
143
|
end
|
166
|
-
|
167
|
-
|
168
|
-
raise_exception_based_on_response!(resp)
|
169
|
-
end
|
170
|
-
|
171
|
-
# Reindex the object in Solr.
|
172
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
173
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
174
|
-
# @return [boolean] true on success
|
175
|
-
def reindex
|
144
|
+
query_string = query_params.any? ? "?#{query_params.join('&')}" : ''
|
145
|
+
publish_path = "#{object_path}/publish#{query_string}"
|
176
146
|
resp = connection.post do |req|
|
177
|
-
req.url
|
147
|
+
req.url publish_path
|
178
148
|
end
|
179
|
-
return
|
149
|
+
return resp.headers['Location'] if resp.success?
|
180
150
|
|
181
151
|
raise_exception_based_on_response!(resp)
|
182
152
|
end
|
153
|
+
# rubocop:enable Metrics/MethodLength
|
183
154
|
|
184
155
|
private
|
185
156
|
|
@@ -13,7 +13,7 @@ module Dor
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
VersionStatus = Struct.new(:versionId, :open, :openable, :assembling, :accessioning, :closeable, keyword_init: true) do
|
16
|
+
VersionStatus = Struct.new(:versionId, :open, :openable, :assembling, :accessioning, :closeable, :discardable, keyword_init: true) do
|
17
17
|
alias_method :version, :versionId
|
18
18
|
|
19
19
|
def open?
|
@@ -39,6 +39,10 @@ module Dor
|
|
39
39
|
def closeable?
|
40
40
|
closeable
|
41
41
|
end
|
42
|
+
|
43
|
+
def discardable?
|
44
|
+
discardable
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
# @param object_identifier [String] the pid for the object
|
@@ -71,29 +75,6 @@ module Dor
|
|
71
75
|
raise_exception_based_on_response!(resp)
|
72
76
|
end
|
73
77
|
|
74
|
-
# Determines if a new version can be opened for a DOR object.
|
75
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
76
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
77
|
-
# @return [Boolean] true if a new version can be opened
|
78
|
-
# rubocop:disable Metrics/MethodLength
|
79
|
-
def openable?
|
80
|
-
resp = connection.get do |req|
|
81
|
-
req.url "#{base_path}/openable"
|
82
|
-
end
|
83
|
-
|
84
|
-
raise_exception_based_on_response!(resp) unless resp.success?
|
85
|
-
|
86
|
-
case resp.body
|
87
|
-
when 'true'
|
88
|
-
true
|
89
|
-
when 'false'
|
90
|
-
false
|
91
|
-
else
|
92
|
-
raise MalformedResponse, "Expected true or false, not #{resp.body}"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
# rubocop:enable Metrics/MethodLength
|
96
|
-
|
97
78
|
# Open new version for an object
|
98
79
|
# @param description [String] a description of the object version being opened - required
|
99
80
|
# @param opening_user_name [String] sunetid - defaults to nil
|
@@ -163,6 +144,18 @@ module Dor
|
|
163
144
|
JSON.parse(resp.body)
|
164
145
|
end
|
165
146
|
|
147
|
+
# Discard current version for an object
|
148
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
149
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
150
|
+
def discard
|
151
|
+
resp = connection.delete do |req|
|
152
|
+
req.url "#{base_path}/current"
|
153
|
+
end
|
154
|
+
return if resp.success?
|
155
|
+
|
156
|
+
raise_exception_based_on_response!(resp)
|
157
|
+
end
|
158
|
+
|
166
159
|
private
|
167
160
|
|
168
161
|
attr_reader :object_identifier
|
@@ -31,24 +31,6 @@ module Dor
|
|
31
31
|
end
|
32
32
|
# rubocop:enable Metrics/AbcSize
|
33
33
|
|
34
|
-
# Cleans up and resets the workspace
|
35
|
-
# After an object has been copied to preservation the workspace can be
|
36
|
-
# reset. This is called by the reset-workspace step of the accessionWF
|
37
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
38
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
39
|
-
# @param [String] lane_id for prioritization (default or low)
|
40
|
-
# @return [String] the URL of the background job on dor-service-app
|
41
|
-
def cleanup(lane_id: nil)
|
42
|
-
cleanup_workspace_path = workspace_path
|
43
|
-
cleanup_workspace_path += "?lane-id=#{lane_id}" if lane_id
|
44
|
-
resp = connection.delete do |req|
|
45
|
-
req.url cleanup_workspace_path
|
46
|
-
end
|
47
|
-
return resp.headers['Location'] if resp.success?
|
48
|
-
|
49
|
-
raise_exception_based_on_response!(resp, object_identifier)
|
50
|
-
end
|
51
|
-
|
52
34
|
private
|
53
35
|
|
54
36
|
def workspace_path
|
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.1
|
4
|
+
version: 15.2.1
|
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: 2024-
|
12
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -17,20 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
- - "<"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '8'
|
20
|
+
version: 7.0.0
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
25
|
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '8'
|
27
|
+
version: 7.0.0
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: cocina-models
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,7 +246,6 @@ files:
|
|
252
246
|
- lib/dor/services/client/release_tag.rb
|
253
247
|
- lib/dor/services/client/release_tags.rb
|
254
248
|
- lib/dor/services/client/response_error_formatter.rb
|
255
|
-
- lib/dor/services/client/transfer.rb
|
256
249
|
- lib/dor/services/client/user_version.rb
|
257
250
|
- lib/dor/services/client/version.rb
|
258
251
|
- lib/dor/services/client/versioned_service.rb
|
@@ -280,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
273
|
- !ruby/object:Gem::Version
|
281
274
|
version: '0'
|
282
275
|
requirements: []
|
283
|
-
rubygems_version: 3.5.
|
276
|
+
rubygems_version: 3.5.11
|
284
277
|
signing_key:
|
285
278
|
specification_version: 4
|
286
279
|
summary: A client for dor-services-app
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dor
|
4
|
-
module Services
|
5
|
-
class Client
|
6
|
-
# API calls that move data around.
|
7
|
-
class Transfer < VersionedService
|
8
|
-
# @param object_identifier [String] the pid for the object
|
9
|
-
def initialize(connection:, version:, object_identifier:)
|
10
|
-
super(connection: connection, version: version)
|
11
|
-
@object_identifier = object_identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
# Publish an object (send to PURL)
|
15
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
16
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
17
|
-
# @param [String] workflow (nil) which workflow to callback to.
|
18
|
-
# @param [String] lane_id for prioritization (default or low)
|
19
|
-
# @return [String] the URL of the background job on dor-service-app
|
20
|
-
def publish(workflow: nil, lane_id: nil)
|
21
|
-
query_params = [].tap do |params|
|
22
|
-
params << "workflow=#{workflow}" if workflow
|
23
|
-
params << "lane-id=#{lane_id}" if lane_id
|
24
|
-
end
|
25
|
-
query_string = query_params.any? ? "?#{query_params.join('&')}" : ''
|
26
|
-
publish_path = "#{object_path}/publish#{query_string}"
|
27
|
-
resp = connection.post do |req|
|
28
|
-
req.url publish_path
|
29
|
-
end
|
30
|
-
return resp.headers['Location'] if resp.success?
|
31
|
-
|
32
|
-
raise_exception_based_on_response!(resp)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Unpublish an object (yank from to PURL)
|
36
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
37
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
38
|
-
# @return [String] the URL of the background job on dor-service-app
|
39
|
-
def unpublish
|
40
|
-
resp = connection.post do |req|
|
41
|
-
req.url "#{object_path}/unpublish"
|
42
|
-
end
|
43
|
-
return resp.headers['Location'] if resp.success?
|
44
|
-
|
45
|
-
raise_exception_based_on_response!(resp)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Preserve an object (send to SDR)
|
49
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
50
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
51
|
-
# @param [String] lane_id for prioritization (default or low)
|
52
|
-
# @return [String] URL from Location response header if no errors
|
53
|
-
def preserve(lane_id: nil)
|
54
|
-
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
55
|
-
resp = connection.post do |req|
|
56
|
-
req.url "#{object_path}/preserve#{query_string}"
|
57
|
-
end
|
58
|
-
return resp.headers['Location'] if resp.success?
|
59
|
-
|
60
|
-
raise_exception_based_on_response!(resp)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Shelve an object (send to Stacks)
|
64
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
65
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
66
|
-
# @param [String] lane_id for prioritization (default or low)
|
67
|
-
# @return [boolean] true on success
|
68
|
-
def shelve(lane_id: nil)
|
69
|
-
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
70
|
-
resp = connection.post do |req|
|
71
|
-
req.url "#{object_path}/shelve#{query_string}"
|
72
|
-
end
|
73
|
-
return resp.headers['Location'] if resp.success?
|
74
|
-
|
75
|
-
raise_exception_based_on_response!(resp)
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def object_path
|
81
|
-
"#{api_version}/objects/#{object_identifier}"
|
82
|
-
end
|
83
|
-
|
84
|
-
attr_reader :object_identifier
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|