dor-services-client 15.14.0 → 15.15.1

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: bd62911db328e4acec57538baa18003ff2525c02929f2f96adbd9df74ba43e30
4
- data.tar.gz: 9591c4c8977d9a81cffbf46a300e04778a60330c0ce9d9743232cc72bcca56e8
3
+ metadata.gz: d5d9a556b75e428095790837c00911af7b048931b9bec6fe9464a76bcffdcc8e
4
+ data.tar.gz: 07e11749b4376ccefd986e71198ec7cfb3faa22cc942a633493a41a55596b097
5
5
  SHA512:
6
- metadata.gz: 8fa6acadd9432a53789fd3d33ab07bafca9d1078544536c80e2bfa661490921201a781c84e1b0a1898264c62e5d5a7d19ac95316409f894b074f88de917d91ea
7
- data.tar.gz: 359df5ae75ca8e63aa4cc5d3fd56e13ce716e3ec67d3e74c4535906f573f4419c041683b1008cd563d098d0fbcf8750b698fe497ad85d825efd9d56528a6a379
6
+ metadata.gz: 6a1d37557291d550355aebc22e3de0774d6dbf03da8bce455e0df4f6f040a171b2fb06f9f70dab5731f05015420a4651739fe0fad7c861019ac9ca6e259a66d5
7
+ data.tar.gz: e0125d4dd139be07ce31ea1f8d0edf77bb516371ae96212517b4467f9e00f318be3e7dfdda8011a0fbb697ab6beb941205dd90c6698b02a86b08329954b91dda
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (15.14.0)
4
+ dor-services-client (15.15.1)
5
5
  activesupport (>= 7.0.0)
6
6
  cocina-models (~> 0.104.1)
7
7
  deprecation
@@ -131,7 +131,7 @@ GEM
131
131
  rspec-core (~> 3.13.0)
132
132
  rspec-expectations (~> 3.13.0)
133
133
  rspec-mocks (~> 3.13.0)
134
- rspec-core (3.13.4)
134
+ rspec-core (3.13.5)
135
135
  rspec-support (~> 3.13.0)
136
136
  rspec-expectations (3.13.5)
137
137
  diff-lcs (>= 1.2.0, < 2.0)
data/README.md CHANGED
@@ -161,11 +161,13 @@ object_client.workflow('etdSubmitWF').create(version: 2)
161
161
  # Skip all workflow steps
162
162
  object_client.workflow('accessionWF').skip_all(note: 'Cleaning up')
163
163
 
164
+ # Get the status of a workflow process
165
+ object_client.workflow('accessionWF').process('shelve').status
166
+ => 'completed'
164
167
  # Update workflow processes
165
168
  object_client.workflow('accessionWF').process('shelve').update(status: 'completed')
166
169
  object_client.workflow('accessionWF').process('shelve').update_error(error_msg: 'Something went wrong', error_text: 'Detailed error message')
167
170
 
168
-
169
171
  # List milestones
170
172
  object_client.milestones.list
171
173
  # Get the date for a milestone
@@ -107,7 +107,7 @@ module Dor
107
107
  def close(**params)
108
108
  resp = connection.post do |req|
109
109
  req.url close_version_path
110
- req.params = params
110
+ req.params = params.compact
111
111
  req.headers['Content-Type'] = 'application/json'
112
112
  end
113
113
  return resp.body if resp.success?
@@ -16,7 +16,7 @@ module Dor
16
16
  # @return [Dor::Services::Client::Process]
17
17
  def process(process)
18
18
  @process ||= Process.new(connection: connection, version: api_version, object_identifier: object_identifier,
19
- workflow_name: workflow_name, process: process)
19
+ workflow_name: workflow_name, process: process, object_workflow_client: self)
20
20
  end
21
21
 
22
22
  # @return [Workflow::Response::Workflow]
@@ -8,11 +8,22 @@ module Dor
8
8
  # @param object_identifier [String] the druid for the object
9
9
  # @param [String] workflow_name The name of the workflow
10
10
  # @param [String] process The name of the workflow step
11
- def initialize(connection:, version:, object_identifier:, workflow_name:, process:)
11
+ def initialize(connection:, version:, object_identifier:, workflow_name:, process:, object_workflow_client:) # rubocop:disable Metrics/ParameterLists
12
12
  super(connection: connection, version: version)
13
13
  @object_identifier = object_identifier
14
14
  @workflow_name = workflow_name
15
15
  @process = process
16
+ @object_workflow_client = object_workflow_client
17
+ end
18
+
19
+ # Retrieves the process status of the given workflow for the given object identifier
20
+ # @return [String,nil] status
21
+ def status
22
+ doc = object_workflow_client.find.xml
23
+
24
+ processes = doc.root.xpath("//process[@name='#{process}']")
25
+ process = processes.max { |a, b| a.attr('version').to_i <=> b.attr('version').to_i }
26
+ process&.attr('status')
16
27
  end
17
28
 
18
29
  # Updates the status of one step in a workflow.
@@ -24,14 +35,6 @@ module Dor
24
35
  # @raise [Dor::Services::Client::ConflictResponse] if the current status does not match the value passed in current_status.
25
36
  def update(status:, elapsed: 0, lifecycle: nil, note: nil, current_status: nil)
26
37
  perform_update(status: status, elapsed: elapsed, lifecycle: lifecycle, note: note, current_status: current_status)
27
- # resp = connection.get do |req|
28
- # req.url "#{api_version}/objects/#{object_identifier}/workflows/#{workflow_name}"
29
- # req.headers['Accept'] = 'application/xml'
30
- # end
31
-
32
- # raise_exception_based_on_response!(resp) unless resp.success?
33
-
34
- # Dor::Services::Response::Workflow.new(xml: Nokogiri::XML(resp.body))
35
38
  end
36
39
 
37
40
  # Updates the status of one step in a workflow to error.
@@ -43,7 +46,7 @@ module Dor
43
46
 
44
47
  private
45
48
 
46
- attr_reader :object_identifier, :workflow_name, :process
49
+ attr_reader :object_identifier, :workflow_name, :process, :object_workflow_client
47
50
 
48
51
  def perform_update(**payload)
49
52
  resp = connection.put do |req|
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '15.14.0'
6
+ VERSION = '15.15.1'
7
7
  end
8
8
  end
9
9
  end
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.14.0
4
+ version: 15.15.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: 2025-06-26 00:00:00.000000000 Z
12
+ date: 2025-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport