dor-services-client 15.67.0 → 15.68.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecbd808105364dbb0e939e9fff80a3df720681c9b06b62e5422bc43c4a45fb34
4
- data.tar.gz: f6969b77a83eba79e20509ae34e7afeccadbca351555e463a26659c16efe398b
3
+ metadata.gz: 6b098e13ed4b3ab09cec8aa5feadf5997bb7dbfa18a21a2cd76023cc860f6648
4
+ data.tar.gz: 9526c7b43a83c75eea0fba7d50c30f98bae90e11df2379d182f3676d4e2a743f
5
5
  SHA512:
6
- metadata.gz: cc2fb1431c27567fed4655fed06c32127b96209e56b732067d703e603f300a0b0633cbc751a9cb63aaba7d9d7fb8f3151ebc8867f75b4572b20794e6f66a8fe2
7
- data.tar.gz: 7fe53128c34e19cbc88e1ae9257bc9af650da2d575f2c87321c8628a7781c1ef053cfc2515d4d118d107de174592cca20c96765fbc2fb013c1d582ef28b4e896
6
+ metadata.gz: 97752c9a761821f0f4054b29ceae2514be935d4c2a0290cb119c134c15fdb4bf8f1cf8a2c8f3e330a6507e159bedcb6252c2a895a311052a075914964bb7c530
7
+ data.tar.gz: 33446c0f137d283e8d4c22436bbff8c4456be4a5b5e3a7389d4dfc545dffb50e9a72c3998b64256d288725f0611679e89aa7e5b71c5d4255c96863f8b0417b9e
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@4.12.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.13.1
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (15.67.0)
4
+ dor-services-client (15.68.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.3.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.2)
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.10.0)
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.3)
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.8.2)
110
+ io-console (0.9.4)
111
111
  iso8601 (0.13.0)
112
112
  janeway-jsonpath (1.1.0)
113
- json (2.21.2)
114
- jsonschema_rs (0.49.3-arm64-darwin)
113
+ json (3.0.2)
114
+ jsonschema_rs (0.58.5-arm64-darwin)
115
115
  bigdecimal (>= 3.1, < 5)
116
- jsonschema_rs (0.49.3-x86_64-darwin)
116
+ jsonschema_rs (0.58.5-x86_64-darwin)
117
117
  bigdecimal (>= 3.1, < 5)
118
- jsonschema_rs (0.49.3-x86_64-linux)
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.1.0)
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.12.0)
147
- reline (0.6.3)
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.88.2)
164
- json (~> 2.3)
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.0.3)
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.2.0)
192
- unicode-emoji (~> 4.1)
193
- unicode-emoji (4.2.0)
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.2)
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.17
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
 
@@ -159,6 +162,9 @@ object_client.release_tags.list(public: true) # only public release tags (i.e. l
159
162
  # Create and list events for an object
160
163
  object_client.events.create(type: type, data: data)
161
164
  object_client.events.list
165
+ object_client.events.list(event_types: ['version_open', 'version_close'])
166
+ # from is inclusive and to is exclusive; either may be a Time, Date, or ISO 8601 string (UTC if no offset is given)
167
+ object_client.events.list(from: '2026-10-01', to: Time.now)
162
168
 
163
169
  # Create workspaces
164
170
  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., publish, shelve
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
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '15.67.0'
6
+ VERSION = '15.68.0'
7
7
  end
8
8
  end
9
9
  end
@@ -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.67.0
4
+ version: 15.68.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.14
311
+ rubygems_version: 4.0.20
311
312
  specification_version: 4
312
313
  summary: A client for dor-services-app
313
314
  test_files: []