dor-services-client 6.26.0 → 6.30.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 +3 -1
- data/.rubocop_todo.yml +6 -11
- data/README.md +4 -0
- data/dor-services-client.gemspec +4 -2
- data/lib/dor/services/client/administrative_tag_search.rb +1 -3
- data/lib/dor/services/client/metadata.rb +40 -1
- data/lib/dor/services/client/mutate.rb +84 -0
- data/lib/dor/services/client/object.rb +6 -77
- data/lib/dor/services/client/object_version.rb +22 -6
- data/lib/dor/services/client/transfer.rb +75 -0
- data/lib/dor/services/client/version.rb +1 -1
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfb9d4401c19f2a4c37d0215e5ca0de1d83af412a23e68bcdf81b30436c569ca
|
4
|
+
data.tar.gz: c60145e4a585153319d2fb445b4339df078112f729e70ca8a79e5544af581f6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4c573973598632a6612049bbdeb009f22aedbf8ef5689a0e5b595c1857b060128054973d3fba55f08eb6d2fa41980213a56f77186532123df3aaacabd1840d
|
7
|
+
data.tar.gz: a5fc25ca9a41457f27ce9f4e716281efe51256016e0137e42efb299cf0fbbee800b5a75f3b840bfba28dca79d99eac14295d6ae5d631dcb15497ddf9b7959cd7
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-03-17 17:24:07 UTC using RuboCop version 1.11.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 2
|
10
|
-
# Configuration parameters: IgnoredMethods.
|
10
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
11
11
|
Metrics/AbcSize:
|
12
|
-
Max:
|
12
|
+
Max: 22
|
13
13
|
|
14
14
|
# Offense count: 1
|
15
|
-
# Configuration parameters: CountComments.
|
16
|
-
Metrics/ClassLength:
|
17
|
-
Max: 115
|
18
|
-
|
19
|
-
# Offense count: 1
|
20
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
21
16
|
Metrics/MethodLength:
|
22
17
|
Max: 11
|
23
18
|
|
@@ -28,9 +23,9 @@ Style/Documentation:
|
|
28
23
|
- 'test/**/*'
|
29
24
|
- 'lib/dor/services/client.rb'
|
30
25
|
|
31
|
-
# Offense count:
|
26
|
+
# Offense count: 77
|
32
27
|
# Cop supports --auto-correct.
|
33
28
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
34
29
|
# URISchemes: http, https
|
35
|
-
|
30
|
+
Layout/LineLength:
|
36
31
|
Max: 164
|
data/README.md
CHANGED
@@ -110,10 +110,14 @@ object_client.update_marc_record
|
|
110
110
|
# Copy metadata from Symphony into descMetadata
|
111
111
|
object_client.refresh_metadata
|
112
112
|
|
113
|
+
# Apply defaults from the item's AdminPolicy to the item itself
|
114
|
+
object_client.apply_admin_policy_defaults
|
115
|
+
|
113
116
|
# Send a notification to goobi
|
114
117
|
object_client.notify_goobi
|
115
118
|
|
116
119
|
# Manage versions
|
120
|
+
object_client.version.inventory
|
117
121
|
object_client.version.current
|
118
122
|
object_client.version.openable?(**params)
|
119
123
|
object_client.version.open(**params)
|
data/dor-services-client.gemspec
CHANGED
@@ -22,8 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
+
spec.required_ruby_version = '~> 2.6'
|
26
|
+
|
25
27
|
spec.add_dependency 'activesupport', '>= 4.2', '< 7'
|
26
|
-
spec.add_dependency 'cocina-models', '~> 0.
|
28
|
+
spec.add_dependency 'cocina-models', '~> 0.56.0' # leave pinned to patch level until cocina-models hits 1.0
|
27
29
|
spec.add_dependency 'deprecation', '>= 0'
|
28
30
|
spec.add_dependency 'faraday', '>= 0.15', '< 2'
|
29
31
|
spec.add_dependency 'moab-versioning', '~> 4.0'
|
@@ -33,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
33
35
|
spec.add_development_dependency 'byebug'
|
34
36
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
35
37
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
-
spec.add_development_dependency 'rubocop', '~>
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
37
39
|
spec.add_development_dependency 'simplecov', '~> 0.17.0' # CodeClimate cannot use SimpleCov >= 0.18.0 for generating test coverage
|
38
40
|
spec.add_development_dependency 'webmock'
|
39
41
|
end
|
@@ -7,8 +7,7 @@ module Dor
|
|
7
7
|
class Client
|
8
8
|
# API calls that are about searching AdministrativeTags
|
9
9
|
class AdministrativeTagSearch < VersionedService
|
10
|
-
# rubocop:disable Naming/
|
11
|
-
def search(q:)
|
10
|
+
def search(q:) # rubocop:disable Naming/MethodParameterName
|
12
11
|
resp = connection.get do |req|
|
13
12
|
req.url "#{api_version}/administrative_tags/search?q=#{q}"
|
14
13
|
end
|
@@ -18,7 +17,6 @@ module Dor
|
|
18
17
|
|
19
18
|
raise_exception_based_on_response!(resp)
|
20
19
|
end
|
21
|
-
# rubocop:enable Naming/UncommunicativeMethodParamName
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -51,7 +51,7 @@ module Dor
|
|
51
51
|
raise_exception_based_on_response!(resp, object_identifier)
|
52
52
|
end
|
53
53
|
|
54
|
-
# @return [String, NilClass] The descriptive metadata XML representation of the object or nil if response is 404
|
54
|
+
# @return [String, NilClass] The public descriptive metadata XML representation of the object or nil if response is 404
|
55
55
|
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
56
56
|
def descriptive
|
57
57
|
resp = connection.get do |req|
|
@@ -63,6 +63,45 @@ module Dor
|
|
63
63
|
raise_exception_based_on_response!(resp, object_identifier)
|
64
64
|
end
|
65
65
|
|
66
|
+
# @return [String, NilClass] the dor object's source MODS XML or nil if response is 404
|
67
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
68
|
+
def mods
|
69
|
+
resp = connection.get do |req|
|
70
|
+
req.url "#{base_path}/mods"
|
71
|
+
end
|
72
|
+
return resp.body if resp.success?
|
73
|
+
return if resp.status == 404
|
74
|
+
|
75
|
+
raise_exception_based_on_response!(resp, object_identifier)
|
76
|
+
end
|
77
|
+
|
78
|
+
# rubocop:disable Lint/StructNewOverride
|
79
|
+
Datastream = Struct.new(:label, :dsid, :pid, :size, :mimeType, :versionId, keyword_init: true)
|
80
|
+
# rubocop:enable Lint/StructNewOverride
|
81
|
+
|
82
|
+
# @return [Array] the list of datastreams for the item
|
83
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
84
|
+
def datastreams
|
85
|
+
resp = connection.get do |req|
|
86
|
+
req.url "#{base_path}/datastreams"
|
87
|
+
end
|
88
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
89
|
+
|
90
|
+
JSON.parse(resp.body).map { |params| Datastream.new(**params.symbolize_keys!) }
|
91
|
+
end
|
92
|
+
|
93
|
+
# @param [String] dsid the identifier for the datastream
|
94
|
+
# @return [String] the contents of the specified datastream
|
95
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
96
|
+
def datastream(dsid)
|
97
|
+
resp = connection.get do |req|
|
98
|
+
req.url "#{base_path}/datastreams/#{dsid}"
|
99
|
+
end
|
100
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
101
|
+
|
102
|
+
resp.body
|
103
|
+
end
|
104
|
+
|
66
105
|
private
|
67
106
|
|
68
107
|
attr_reader :object_identifier
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dor
|
4
|
+
module Services
|
5
|
+
class Client
|
6
|
+
# API calls that update the data.
|
7
|
+
class Mutate < 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
|
+
# Copies the values from the admin policy to the item
|
15
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
16
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
17
|
+
# @return [boolean] true on success
|
18
|
+
def apply_admin_policy_defaults
|
19
|
+
resp = connection.post do |req|
|
20
|
+
req.url "#{object_path}/apply_admin_policy_defaults"
|
21
|
+
end
|
22
|
+
|
23
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
24
|
+
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
# Updates the object
|
29
|
+
# @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] params model object
|
30
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
31
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
32
|
+
# @return [Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy] the returned model
|
33
|
+
def update(params:)
|
34
|
+
resp = connection.patch do |req|
|
35
|
+
req.url object_path
|
36
|
+
req.headers['Content-Type'] = 'application/json'
|
37
|
+
# asking the service to return JSON (else it'll be plain text)
|
38
|
+
req.headers['Accept'] = 'application/json'
|
39
|
+
req.body = params.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
43
|
+
|
44
|
+
Cocina::Models.build(JSON.parse(resp.body))
|
45
|
+
end
|
46
|
+
|
47
|
+
# Pull in metadata from Symphony and updates descriptive metadata
|
48
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
49
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
50
|
+
# @return [boolean] true on success
|
51
|
+
def refresh_metadata
|
52
|
+
resp = connection.post do |req|
|
53
|
+
req.url "#{object_path}/refresh_metadata"
|
54
|
+
end
|
55
|
+
|
56
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
57
|
+
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Destroys an object
|
62
|
+
# @return [Boolean] true if successful
|
63
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
64
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
65
|
+
def destroy
|
66
|
+
resp = connection.delete do |req|
|
67
|
+
req.url object_path
|
68
|
+
end
|
69
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
70
|
+
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def object_path
|
77
|
+
"#{api_version}/objects/#{object_identifier}"
|
78
|
+
end
|
79
|
+
|
80
|
+
attr_reader :object_identifier
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -73,25 +73,6 @@ module Dor
|
|
73
73
|
[model, metadata]
|
74
74
|
end
|
75
75
|
|
76
|
-
# Updates the object
|
77
|
-
# @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] params model object
|
78
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
79
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
80
|
-
# @return [Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy] the returned model
|
81
|
-
def update(params:)
|
82
|
-
resp = connection.patch do |req|
|
83
|
-
req.url object_path
|
84
|
-
req.headers['Content-Type'] = 'application/json'
|
85
|
-
# asking the service to return JSON (else it'll be plain text)
|
86
|
-
req.headers['Accept'] = 'application/json'
|
87
|
-
req.body = params.to_json
|
88
|
-
end
|
89
|
-
|
90
|
-
return Cocina::Models.build(JSON.parse(resp.body)) if resp.success?
|
91
|
-
|
92
|
-
raise_exception_based_on_response!(resp)
|
93
|
-
end
|
94
|
-
|
95
76
|
# Get a list of the collections. (Similar to Valkyrie's find_inverse_references_by)
|
96
77
|
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
97
78
|
# @return [Array<Cocina::Models::DRO>]
|
@@ -106,56 +87,17 @@ module Dor
|
|
106
87
|
Members.new(**parent_params).members
|
107
88
|
end
|
108
89
|
|
109
|
-
|
110
|
-
|
111
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
112
|
-
# @param [String] workflow ('accessionWF') which workflow to callback to.
|
113
|
-
# @param [String] lane_id for prioritization (default or low)
|
114
|
-
# @return [boolean] true on success
|
115
|
-
def publish(workflow: nil, lane_id: nil)
|
116
|
-
query_params = [].tap do |params|
|
117
|
-
params << "workflow=#{workflow}" if workflow
|
118
|
-
params << "lane-id=#{lane_id}" if lane_id
|
119
|
-
end
|
120
|
-
query_string = query_params.any? ? "?#{query_params.join('&')}" : ''
|
121
|
-
publish_path = "#{object_path}/publish#{query_string}"
|
122
|
-
resp = connection.post do |req|
|
123
|
-
req.url publish_path
|
124
|
-
end
|
125
|
-
return resp.headers['Location'] if resp.success?
|
126
|
-
|
127
|
-
raise_exception_based_on_response!(resp)
|
90
|
+
def transfer
|
91
|
+
Transfer.new(**parent_params)
|
128
92
|
end
|
129
93
|
|
130
|
-
|
131
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
132
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
133
|
-
# @param [String] lane_id for prioritization (default or low)
|
134
|
-
# @return [String] URL from Location response header if no errors
|
135
|
-
def preserve(lane_id: nil)
|
136
|
-
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
137
|
-
resp = connection.post do |req|
|
138
|
-
req.url "#{object_path}/preserve#{query_string}"
|
139
|
-
end
|
140
|
-
return resp.headers['Location'] if resp.success?
|
94
|
+
delegate :publish, :preserve, :shelve, to: :transfer
|
141
95
|
|
142
|
-
|
96
|
+
def mutate
|
97
|
+
Mutate.new(**parent_params)
|
143
98
|
end
|
144
99
|
|
145
|
-
|
146
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
147
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
148
|
-
# @param [String] lane_id for prioritization (default or low)
|
149
|
-
# @return [boolean] true on success
|
150
|
-
def shelve(lane_id: nil)
|
151
|
-
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
152
|
-
resp = connection.post do |req|
|
153
|
-
req.url "#{object_path}/shelve#{query_string}"
|
154
|
-
end
|
155
|
-
return resp.headers['Location'] if resp.success?
|
156
|
-
|
157
|
-
raise_exception_based_on_response!(resp)
|
158
|
-
end
|
100
|
+
delegate :refresh_metadata, :update, :destroy, :apply_admin_policy_defaults, to: :mutate
|
159
101
|
|
160
102
|
# Update the marc record for the given object
|
161
103
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
@@ -170,19 +112,6 @@ module Dor
|
|
170
112
|
raise_exception_based_on_response!(resp)
|
171
113
|
end
|
172
114
|
|
173
|
-
# Pull in metadata from Symphony and update descMetadata
|
174
|
-
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
175
|
-
# @raise [UnexpectedResponse] when the response is not successful.
|
176
|
-
# @return [boolean] true on success
|
177
|
-
def refresh_metadata
|
178
|
-
resp = connection.post do |req|
|
179
|
-
req.url "#{object_path}/refresh_metadata"
|
180
|
-
end
|
181
|
-
return true if resp.success?
|
182
|
-
|
183
|
-
raise_exception_based_on_response!(resp)
|
184
|
-
end
|
185
|
-
|
186
115
|
# Notify the external Goobi system for a new object that was registered in DOR
|
187
116
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
188
117
|
# @raise [UnexpectedResponse] when the response is not successful.
|
@@ -5,6 +5,8 @@ module Dor
|
|
5
5
|
class Client
|
6
6
|
# API calls that are about versions
|
7
7
|
class ObjectVersion < VersionedService
|
8
|
+
Version = Struct.new(:versionId, :tag, :message, keyword_init: true)
|
9
|
+
|
8
10
|
# @param object_identifier [String] the pid for the object
|
9
11
|
def initialize(connection:, version:, object_identifier:)
|
10
12
|
super(connection: connection, version: version)
|
@@ -17,7 +19,7 @@ module Dor
|
|
17
19
|
# @return [String] the version identifier
|
18
20
|
def current
|
19
21
|
resp = connection.get do |req|
|
20
|
-
req.url "#{
|
22
|
+
req.url "#{base_path}/current"
|
21
23
|
end
|
22
24
|
return resp.body if resp.success?
|
23
25
|
|
@@ -32,15 +34,16 @@ module Dor
|
|
32
34
|
# rubocop:disable Metrics/MethodLength
|
33
35
|
def openable?(**params)
|
34
36
|
resp = connection.get do |req|
|
35
|
-
req.url "#{
|
37
|
+
req.url "#{base_path}/openable"
|
36
38
|
req.params = params
|
37
39
|
end
|
38
40
|
|
39
41
|
raise_exception_based_on_response!(resp) unless resp.success?
|
40
42
|
|
41
|
-
|
43
|
+
case resp.body
|
44
|
+
when 'true'
|
42
45
|
true
|
43
|
-
|
46
|
+
when 'false'
|
44
47
|
false
|
45
48
|
else
|
46
49
|
raise MalformedResponse, "Expected true or false, not #{resp.body}"
|
@@ -77,6 +80,17 @@ module Dor
|
|
77
80
|
raise_exception_based_on_response!(resp)
|
78
81
|
end
|
79
82
|
|
83
|
+
# @return [Array] a list of the versions
|
84
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
85
|
+
def inventory
|
86
|
+
resp = connection.get do |req|
|
87
|
+
req.url base_path
|
88
|
+
end
|
89
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
90
|
+
|
91
|
+
JSON.parse(resp.body).fetch('versions').map { |params| Version.new(**params.symbolize_keys!) }
|
92
|
+
end
|
93
|
+
|
80
94
|
private
|
81
95
|
|
82
96
|
attr_reader :object_identifier
|
@@ -101,12 +115,14 @@ module Dor
|
|
101
115
|
raise_exception_based_on_response!(resp)
|
102
116
|
end
|
103
117
|
|
104
|
-
def
|
118
|
+
def base_path
|
105
119
|
"#{object_path}/versions"
|
106
120
|
end
|
107
121
|
|
122
|
+
alias open_new_version_path base_path
|
123
|
+
|
108
124
|
def close_version_path
|
109
|
-
"#{
|
125
|
+
"#{base_path}/current/close"
|
110
126
|
end
|
111
127
|
end
|
112
128
|
end
|
@@ -0,0 +1,75 @@
|
|
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 ('accessionWF') which workflow to callback to.
|
18
|
+
# @param [String] lane_id for prioritization (default or low)
|
19
|
+
# @return [boolean] true on success
|
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
|
+
# Preserve an object (send to SDR)
|
36
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
37
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
38
|
+
# @param [String] lane_id for prioritization (default or low)
|
39
|
+
# @return [String] URL from Location response header if no errors
|
40
|
+
def preserve(lane_id: nil)
|
41
|
+
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
42
|
+
resp = connection.post do |req|
|
43
|
+
req.url "#{object_path}/preserve#{query_string}"
|
44
|
+
end
|
45
|
+
return resp.headers['Location'] if resp.success?
|
46
|
+
|
47
|
+
raise_exception_based_on_response!(resp)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Shelve an object (send to Stacks)
|
51
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
52
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
53
|
+
# @param [String] lane_id for prioritization (default or low)
|
54
|
+
# @return [boolean] true on success
|
55
|
+
def shelve(lane_id: nil)
|
56
|
+
query_string = lane_id ? "?lane-id=#{lane_id}" : ''
|
57
|
+
resp = connection.post do |req|
|
58
|
+
req.url "#{object_path}/shelve#{query_string}"
|
59
|
+
end
|
60
|
+
return resp.headers['Location'] if resp.success?
|
61
|
+
|
62
|
+
raise_exception_based_on_response!(resp)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def object_path
|
68
|
+
"#{api_version}/objects/#{object_identifier}"
|
69
|
+
end
|
70
|
+
|
71
|
+
attr_reader :object_identifier
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.30.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
- Michael Giarlo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-18 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.56.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.56.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: deprecation
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,14 +169,14 @@ dependencies:
|
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: '1.0'
|
173
173
|
type: :development
|
174
174
|
prerelease: false
|
175
175
|
version_requirements: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
179
|
+
version: '1.0'
|
180
180
|
- !ruby/object:Gem::Dependency
|
181
181
|
name: simplecov
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,7 +205,7 @@ dependencies:
|
|
205
205
|
- - ">="
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
|
-
description:
|
208
|
+
description:
|
209
209
|
email:
|
210
210
|
- jcoyne@justincoyne.com
|
211
211
|
- leftwing@alumni.rutgers.edu
|
@@ -240,11 +240,13 @@ files:
|
|
240
240
|
- lib/dor/services/client/marcxml.rb
|
241
241
|
- lib/dor/services/client/members.rb
|
242
242
|
- lib/dor/services/client/metadata.rb
|
243
|
+
- lib/dor/services/client/mutate.rb
|
243
244
|
- lib/dor/services/client/object.rb
|
244
245
|
- lib/dor/services/client/object_version.rb
|
245
246
|
- lib/dor/services/client/objects.rb
|
246
247
|
- lib/dor/services/client/release_tags.rb
|
247
248
|
- lib/dor/services/client/response_error_formatter.rb
|
249
|
+
- lib/dor/services/client/transfer.rb
|
248
250
|
- lib/dor/services/client/version.rb
|
249
251
|
- lib/dor/services/client/versioned_service.rb
|
250
252
|
- lib/dor/services/client/virtual_objects.rb
|
@@ -252,23 +254,23 @@ files:
|
|
252
254
|
homepage: https://github.com/sul-dlss/dor-services-client
|
253
255
|
licenses: []
|
254
256
|
metadata: {}
|
255
|
-
post_install_message:
|
257
|
+
post_install_message:
|
256
258
|
rdoc_options: []
|
257
259
|
require_paths:
|
258
260
|
- lib
|
259
261
|
required_ruby_version: !ruby/object:Gem::Requirement
|
260
262
|
requirements:
|
261
|
-
- - "
|
263
|
+
- - "~>"
|
262
264
|
- !ruby/object:Gem::Version
|
263
|
-
version: '
|
265
|
+
version: '2.6'
|
264
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
267
|
requirements:
|
266
268
|
- - ">="
|
267
269
|
- !ruby/object:Gem::Version
|
268
270
|
version: '0'
|
269
271
|
requirements: []
|
270
|
-
rubygems_version: 3.
|
271
|
-
signing_key:
|
272
|
+
rubygems_version: 3.1.4
|
273
|
+
signing_key:
|
272
274
|
specification_version: 4
|
273
275
|
summary: A client for dor-services-app
|
274
276
|
test_files: []
|