dor-services-client 15.67.0 → 15.69.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/.circleci/config.yml +1 -1
- data/Gemfile.lock +21 -21
- data/README.md +8 -0
- data/lib/dor/services/client/event_types.rb +26 -0
- data/lib/dor/services/client/events.rb +13 -3
- data/lib/dor/services/client/object_version.rb +17 -0
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client.rb +6 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7eb1b5eb6201610e9bd4496dcc0709e4a3348639aae0655c25373b98d00c621
|
|
4
|
+
data.tar.gz: f45e73e423f64393198f41d2ef7f4d954bc0794b470aea4e7b647e2f37cd2e01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba12e822c3fcbd54f30d140ed114ee680854580b00a9632aa77b6f1081ca31258693836f4b5b325e18bfde34c38c3055cd81c6e4cc6f7c18ceb76de03403ac50
|
|
7
|
+
data.tar.gz: 5d825bc8d170005932dcd7d9d104c43ad7a3560aa6e99673c245fa6abbf1de01993286cef5aeb4930ea297db304fa88db58a5bd6ea6b6bd6d2deb595e51869d3
|
data/.circleci/config.yml
CHANGED
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.69.0)
|
|
5
5
|
activesupport (>= 7.0.0)
|
|
6
6
|
cocina-models (~> 0.133.0)
|
|
7
7
|
deprecation
|
|
@@ -14,7 +14,7 @@ PATH
|
|
|
14
14
|
GEM
|
|
15
15
|
remote: https://rubygems.org/
|
|
16
16
|
specs:
|
|
17
|
-
activesupport (8.1.
|
|
17
|
+
activesupport (8.1.4)
|
|
18
18
|
base64
|
|
19
19
|
bigdecimal
|
|
20
20
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
@@ -32,7 +32,7 @@ GEM
|
|
|
32
32
|
ast (2.4.3)
|
|
33
33
|
attr_extras (7.1.0)
|
|
34
34
|
base64 (0.3.0)
|
|
35
|
-
bigdecimal (4.1.
|
|
35
|
+
bigdecimal (4.1.3)
|
|
36
36
|
byebug (13.0.0)
|
|
37
37
|
reline (>= 0.6.0)
|
|
38
38
|
cocina-models (0.133.0)
|
|
@@ -49,7 +49,7 @@ GEM
|
|
|
49
49
|
super_diff
|
|
50
50
|
thor
|
|
51
51
|
zeitwerk (~> 2.1)
|
|
52
|
-
cocina_display (2.
|
|
52
|
+
cocina_display (2.13.0)
|
|
53
53
|
activesupport (>= 7)
|
|
54
54
|
edtf (~> 3.2)
|
|
55
55
|
geo_coord (~> 0.2)
|
|
@@ -92,7 +92,7 @@ GEM
|
|
|
92
92
|
activesupport (>= 3.0, < 9.0)
|
|
93
93
|
equivalent-xml (0.6.0)
|
|
94
94
|
nokogiri (>= 1.4.3)
|
|
95
|
-
faraday (2.14.
|
|
95
|
+
faraday (2.14.4)
|
|
96
96
|
faraday-net_http (>= 2.0, < 3.5)
|
|
97
97
|
json
|
|
98
98
|
logger
|
|
@@ -107,15 +107,15 @@ GEM
|
|
|
107
107
|
i18n (1.15.2)
|
|
108
108
|
concurrent-ruby (~> 1.0)
|
|
109
109
|
ice_nine (0.11.2)
|
|
110
|
-
io-console (0.
|
|
110
|
+
io-console (0.9.4)
|
|
111
111
|
iso8601 (0.13.0)
|
|
112
112
|
janeway-jsonpath (1.1.0)
|
|
113
|
-
json (
|
|
114
|
-
jsonschema_rs (0.
|
|
113
|
+
json (3.0.2)
|
|
114
|
+
jsonschema_rs (0.58.5-arm64-darwin)
|
|
115
115
|
bigdecimal (>= 3.1, < 5)
|
|
116
|
-
jsonschema_rs (0.
|
|
116
|
+
jsonschema_rs (0.58.5-x86_64-darwin)
|
|
117
117
|
bigdecimal (>= 3.1, < 5)
|
|
118
|
-
jsonschema_rs (0.
|
|
118
|
+
jsonschema_rs (0.58.5-x86_64-linux)
|
|
119
119
|
bigdecimal (>= 3.1, < 5)
|
|
120
120
|
language_server-protocol (3.17.0.6)
|
|
121
121
|
lint_roller (1.1.0)
|
|
@@ -132,7 +132,7 @@ GEM
|
|
|
132
132
|
nokogiri (1.19.4-x86_64-linux-gnu)
|
|
133
133
|
racc (~> 1.4)
|
|
134
134
|
optimist (3.2.1)
|
|
135
|
-
parallel (2.
|
|
135
|
+
parallel (2.3.0)
|
|
136
136
|
parser (3.3.12.0)
|
|
137
137
|
ast (~> 2.4.1)
|
|
138
138
|
racc
|
|
@@ -143,8 +143,8 @@ GEM
|
|
|
143
143
|
racc (1.8.1)
|
|
144
144
|
rainbow (3.1.1)
|
|
145
145
|
rake (13.4.2)
|
|
146
|
-
regexp_parser (2.
|
|
147
|
-
reline (0.
|
|
146
|
+
regexp_parser (2.13.1)
|
|
147
|
+
reline (0.7.0)
|
|
148
148
|
io-console (~> 0.5)
|
|
149
149
|
rexml (3.4.4)
|
|
150
150
|
rspec (3.13.2)
|
|
@@ -160,8 +160,8 @@ GEM
|
|
|
160
160
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
161
161
|
rspec-support (~> 3.13.0)
|
|
162
162
|
rspec-support (3.13.7)
|
|
163
|
-
rubocop (1.
|
|
164
|
-
json (
|
|
163
|
+
rubocop (1.91.0)
|
|
164
|
+
json (>= 2.3)
|
|
165
165
|
language_server-protocol (~> 3.17.0.2)
|
|
166
166
|
lint_roller (~> 1.1.0)
|
|
167
167
|
parallel (>= 1.10)
|
|
@@ -180,7 +180,7 @@ GEM
|
|
|
180
180
|
rubocop (~> 1.86, >= 1.86.2)
|
|
181
181
|
ruby-progressbar (1.13.0)
|
|
182
182
|
securerandom (0.4.1)
|
|
183
|
-
simplecov (1.
|
|
183
|
+
simplecov (1.3.2)
|
|
184
184
|
super_diff (0.19.0)
|
|
185
185
|
attr_extras (>= 6.2.4, < 8)
|
|
186
186
|
diff-lcs (~> 1.5)
|
|
@@ -188,11 +188,11 @@ GEM
|
|
|
188
188
|
thor (1.5.0)
|
|
189
189
|
tzinfo (2.0.6)
|
|
190
190
|
concurrent-ruby (~> 1.0)
|
|
191
|
-
unicode-display_width (3.
|
|
192
|
-
unicode-emoji (~> 4.
|
|
193
|
-
unicode-emoji (4.
|
|
191
|
+
unicode-display_width (3.3.0)
|
|
192
|
+
unicode-emoji (~> 4.3)
|
|
193
|
+
unicode-emoji (4.3.0)
|
|
194
194
|
uri (1.1.1)
|
|
195
|
-
webmock (3.26.
|
|
195
|
+
webmock (3.26.4)
|
|
196
196
|
addressable (>= 2.8.0)
|
|
197
197
|
crack (>= 0.3.2)
|
|
198
198
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -220,4 +220,4 @@ DEPENDENCIES
|
|
|
220
220
|
webmock
|
|
221
221
|
|
|
222
222
|
BUNDLED WITH
|
|
223
|
-
4.0.
|
|
223
|
+
4.0.22
|
data/README.md
CHANGED
|
@@ -83,6 +83,9 @@ background_jobs_client = Dor::Services::Client.background_job_results
|
|
|
83
83
|
# Show results of background job
|
|
84
84
|
background_jobs_client.show(job_id: 123)
|
|
85
85
|
|
|
86
|
+
# List the valid event types
|
|
87
|
+
Dor::Services::Client.event_types.list
|
|
88
|
+
|
|
86
89
|
# For performing operations on a known, registered object
|
|
87
90
|
object_client = Dor::Services::Client.object(object_identifier)
|
|
88
91
|
|
|
@@ -117,6 +120,8 @@ object_client.version.solr(2)
|
|
|
117
120
|
object_client.version.open(description: 'Changed title')
|
|
118
121
|
# see dor-services-app openapi.yml for optional params
|
|
119
122
|
object_client.version.close
|
|
123
|
+
# Update the description of the currently open version
|
|
124
|
+
object_client.version.update_description(description: 'Changed title and abstract', user_name: 'some_sunetid')
|
|
120
125
|
|
|
121
126
|
# Manage user versions
|
|
122
127
|
object_client.user_version.inventory
|
|
@@ -159,6 +164,9 @@ object_client.release_tags.list(public: true) # only public release tags (i.e. l
|
|
|
159
164
|
# Create and list events for an object
|
|
160
165
|
object_client.events.create(type: type, data: data)
|
|
161
166
|
object_client.events.list
|
|
167
|
+
object_client.events.list(event_types: ['version_open', 'version_close'])
|
|
168
|
+
# from is inclusive and to is exclusive; either may be a Time, Date, or ISO 8601 string (UTC if no offset is given)
|
|
169
|
+
object_client.events.list(from: '2026-10-01', to: Time.now)
|
|
162
170
|
|
|
163
171
|
# Create workspaces
|
|
164
172
|
object_client.workspace.create(source: object_path_string)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module Dor
|
|
6
|
+
module Services
|
|
7
|
+
class Client
|
|
8
|
+
# API calls around event types from dor-services-app
|
|
9
|
+
class EventTypes < VersionedService
|
|
10
|
+
# List the valid event types
|
|
11
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
|
12
|
+
# @return [Array<String>] the valid event types, sorted
|
|
13
|
+
def list
|
|
14
|
+
resp = connection.get do |req|
|
|
15
|
+
req.url "#{api_version}/event_types"
|
|
16
|
+
req.headers['Accept'] = 'application/json'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
return JSON.parse(resp.body) if resp.success?
|
|
20
|
+
|
|
21
|
+
raise_exception_based_on_response!(resp)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -13,9 +13,10 @@ module Dor
|
|
|
13
13
|
@object_identifier = object_identifier
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# @param type [String] a type for the event, e.g.,
|
|
16
|
+
# @param type [String] a type for the event, e.g., version_open, publishing_complete. Must be a known event type (see EventTypes#list).
|
|
17
17
|
# @param data [Hash] an unstructured hash of event data
|
|
18
18
|
# @return [Boolean] true if successful
|
|
19
|
+
# @raise [BadRequestError] when the event is invalid, e.g., the event type is unknown
|
|
19
20
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
|
20
21
|
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
|
21
22
|
def create(type:, data:)
|
|
@@ -31,11 +32,16 @@ module Dor
|
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
# @param event_types [Array<String>,NilClass] an array of event types to filter by, or nil for all
|
|
35
|
+
# @param from [Time,Date,String,NilClass] only events created at or after this time (inclusive), or nil for no lower bound.
|
|
36
|
+
# A String must be an ISO 8601 date or date-time; UTC if no offset is given.
|
|
37
|
+
# @param to [Time,Date,String,NilClass] only events created before this time (exclusive), or nil for no upper bound.
|
|
38
|
+
# A String must be an ISO 8601 date or date-time; UTC if no offset is given.
|
|
34
39
|
# @return [Array<Event>,NilClass] The events for an object or nil if 404
|
|
40
|
+
# @raise [BadRequestError] when from or to is invalid
|
|
35
41
|
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
|
36
|
-
def list(event_types: nil)
|
|
42
|
+
def list(event_types: nil, from: nil, to: nil)
|
|
37
43
|
resp = connection.get("#{api_version}/objects/#{object_identifier}/events",
|
|
38
|
-
{ event_types: event_types }.compact)
|
|
44
|
+
{ event_types: event_types, from: iso8601(from), to: iso8601(to) }.compact)
|
|
39
45
|
return response_to_models(resp) if resp.success?
|
|
40
46
|
return if resp.status == 404
|
|
41
47
|
|
|
@@ -46,6 +52,10 @@ module Dor
|
|
|
46
52
|
|
|
47
53
|
attr_reader :object_identifier
|
|
48
54
|
|
|
55
|
+
def iso8601(value)
|
|
56
|
+
value.respond_to?(:iso8601) ? value.iso8601 : value
|
|
57
|
+
end
|
|
58
|
+
|
|
49
59
|
def response_to_models(resp)
|
|
50
60
|
JSON.parse(resp.body).map { |data| Event.new(event_type: data['event_type'], data: data['data'], timestamp: data['created_at']) }
|
|
51
61
|
end
|
|
@@ -123,6 +123,23 @@ module Dor
|
|
|
123
123
|
raise_exception_based_on_response!(resp)
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
# Update the description of the currently open version for an object
|
|
127
|
+
# @param description [String] the new description of the version - required
|
|
128
|
+
# @param user_name [String] (optional) - sunetid
|
|
129
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
|
130
|
+
# @raise [ConflictResponse] when the response is a 409 (no version is open)
|
|
131
|
+
# @raise [UnexpectedResponse] when the response is not successful.
|
|
132
|
+
def update_description(description:, user_name: nil)
|
|
133
|
+
resp = connection.patch do |req|
|
|
134
|
+
req.url "#{base_path}/current"
|
|
135
|
+
req.headers['Content-Type'] = 'application/json'
|
|
136
|
+
req.body = { description: description, user_name: user_name }.compact.to_json
|
|
137
|
+
end
|
|
138
|
+
return if resp.success?
|
|
139
|
+
|
|
140
|
+
raise_exception_based_on_response!(resp)
|
|
141
|
+
end
|
|
142
|
+
|
|
126
143
|
# @return [Array] a list of the versions
|
|
127
144
|
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
|
128
145
|
def inventory
|
data/lib/dor/services/client.rb
CHANGED
|
@@ -122,6 +122,11 @@ module Dor
|
|
|
122
122
|
@background_job_results ||= BackgroundJobResults.new(connection: connection, version: DEFAULT_VERSION)
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
+
# @return [Dor::Services::Client::EventTypes] an instance of the `Client::EventTypes` class
|
|
126
|
+
def event_types
|
|
127
|
+
@event_types ||= EventTypes.new(connection: connection, version: DEFAULT_VERSION)
|
|
128
|
+
end
|
|
129
|
+
|
|
125
130
|
# @return [Dor::Services::Client::Workflows] an instance of the `Client::Workflows` class
|
|
126
131
|
def workflows
|
|
127
132
|
@workflows ||= Workflows.new(connection: connection, version: DEFAULT_VERSION)
|
|
@@ -144,7 +149,7 @@ module Dor
|
|
|
144
149
|
self
|
|
145
150
|
end
|
|
146
151
|
|
|
147
|
-
delegate :background_job_results, :objects, :object, :virtual_objects, :administrative_tags, :workflows, to: :instance
|
|
152
|
+
delegate :background_job_results, :event_types, :objects, :object, :virtual_objects, :administrative_tags, :workflows, to: :instance
|
|
148
153
|
end
|
|
149
154
|
|
|
150
155
|
attr_writer :url, :token, :connection, :enable_get_retries, :logger
|
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.69.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -263,6 +263,7 @@ files:
|
|
|
263
263
|
- lib/dor/services/client/background_job_results.rb
|
|
264
264
|
- lib/dor/services/client/collections.rb
|
|
265
265
|
- lib/dor/services/client/error_faraday_middleware.rb
|
|
266
|
+
- lib/dor/services/client/event_types.rb
|
|
266
267
|
- lib/dor/services/client/events.rb
|
|
267
268
|
- lib/dor/services/client/invalid_cocina.rb
|
|
268
269
|
- lib/dor/services/client/members.rb
|
|
@@ -307,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
307
308
|
- !ruby/object:Gem::Version
|
|
308
309
|
version: '0'
|
|
309
310
|
requirements: []
|
|
310
|
-
rubygems_version: 4.0.
|
|
311
|
+
rubygems_version: 4.0.20
|
|
311
312
|
specification_version: 4
|
|
312
313
|
summary: A client for dor-services-app
|
|
313
314
|
test_files: []
|