dor-workflow-client 7.4.1 → 7.5.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: 5b29586cf5f0f5d2fd768d99ae4533af1d29e1879daa96b1e5611e09ef8195ff
4
- data.tar.gz: 74c7641b0e942528005d65318116702a5cba4171b6f833f2ec46aa3065619ac7
3
+ metadata.gz: 345824c332c0c9924a29f4189eea47d59a9ad3f65a99a4cf03cd4eca153fb4ba
4
+ data.tar.gz: 81d446a74ca5b8e585db805350d0ca278e15bc23606ea51b9223e62ebc81f839
5
5
  SHA512:
6
- metadata.gz: 46e27f180e3df6018706a9f01051ff09e757795bdc76e013ff8e493a01ba45a639f054a0fefa55f340e3aa054c7458eb4fc82acc8233f2c28208a8476e17c5b3
7
- data.tar.gz: 9597f00cc9074bac61867dd441b2d96150ce814763c2d5e25b84e3741b905a0233f5a96e1061f61ba0f43aef13a5aebb57f18f9911d12026c7e51acc78ffc832
6
+ metadata.gz: c6a4ca91c098a131637d5af1c001354d9d749cdf34b47d4f161d91a3085bfc108820eb33d2563eed8082dda74274aa63fd3b80660975a0005477cd6e59d2472c
7
+ data.tar.gz: 8d24d0561c7d2f80201c4f1d39dc68efdd694e126fc972e339fd2b87ba16d2f27062c1213c6e9e0eed2ba22df69f1803b8d0bc823dad6cdf9d99e48d693f884d
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.2.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.2.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-workflow-client (7.4.1)
4
+ dor-workflow-client (7.5.0)
5
5
  activesupport (>= 3.2.1, < 8)
6
6
  deprecation (>= 0.99.0)
7
7
  faraday (~> 2.0)
@@ -12,7 +12,7 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (7.1.3.3)
15
+ activesupport (7.1.3.4)
16
16
  base64
17
17
  bigdecimal
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -28,7 +28,7 @@ GEM
28
28
  base64 (0.2.0)
29
29
  bigdecimal (3.1.8)
30
30
  byebug (11.1.3)
31
- concurrent-ruby (1.2.3)
31
+ concurrent-ruby (1.3.3)
32
32
  connection_pool (2.4.1)
33
33
  crack (1.0.0)
34
34
  bigdecimal
@@ -38,7 +38,7 @@ GEM
38
38
  diff-lcs (1.5.1)
39
39
  docile (1.4.0)
40
40
  drb (2.2.1)
41
- faraday (2.9.0)
41
+ faraday (2.9.1)
42
42
  faraday-net_http (>= 2.0, < 3.2)
43
43
  faraday-net_http (3.1.0)
44
44
  net-http
@@ -49,32 +49,32 @@ GEM
49
49
  concurrent-ruby (~> 1.0)
50
50
  json (2.7.2)
51
51
  language_server-protocol (3.17.0.3)
52
- mini_portile2 (2.8.6)
53
- minitest (5.23.0)
52
+ mini_portile2 (2.8.7)
53
+ minitest (5.23.1)
54
54
  mutex_m (0.2.0)
55
55
  net-http (0.4.1)
56
56
  uri
57
- nokogiri (1.16.5)
57
+ nokogiri (1.16.6)
58
58
  mini_portile2 (~> 2.8.2)
59
59
  racc (~> 1.4)
60
- parallel (1.24.0)
61
- parser (3.3.1.0)
60
+ parallel (1.25.1)
61
+ parser (3.3.3.0)
62
62
  ast (~> 2.4.1)
63
63
  racc
64
- public_suffix (5.0.5)
64
+ public_suffix (5.1.1)
65
65
  racc (1.8.0)
66
66
  rainbow (3.1.1)
67
67
  rake (13.2.1)
68
68
  regexp_parser (2.9.2)
69
- rexml (3.2.8)
70
- strscan (>= 3.0.9)
69
+ rexml (3.3.0)
70
+ strscan
71
71
  rspec (3.13.0)
72
72
  rspec-core (~> 3.13.0)
73
73
  rspec-expectations (~> 3.13.0)
74
74
  rspec-mocks (~> 3.13.0)
75
75
  rspec-core (3.13.0)
76
76
  rspec-support (~> 3.13.0)
77
- rspec-expectations (3.13.0)
77
+ rspec-expectations (3.13.1)
78
78
  diff-lcs (>= 1.2.0, < 2.0)
79
79
  rspec-support (~> 3.13.0)
80
80
  rspec-mocks (3.13.1)
@@ -83,7 +83,7 @@ GEM
83
83
  rspec-support (3.13.1)
84
84
  rspec_junit_formatter (0.6.0)
85
85
  rspec-core (>= 2, < 4, != 2.12.0)
86
- rubocop (1.63.5)
86
+ rubocop (1.64.1)
87
87
  json (~> 2.3)
88
88
  language_server-protocol (>= 3.17.0)
89
89
  parallel (~> 1.10)
@@ -96,19 +96,19 @@ GEM
96
96
  unicode-display_width (>= 2.4.0, < 3.0)
97
97
  rubocop-ast (1.31.3)
98
98
  parser (>= 3.3.1.0)
99
- rubocop-capybara (2.20.0)
100
- rubocop (~> 1.41)
101
- rubocop-factory_bot (2.25.1)
99
+ rubocop-capybara (2.21.0)
102
100
  rubocop (~> 1.41)
101
+ rubocop-factory_bot (2.26.1)
102
+ rubocop (~> 1.61)
103
103
  rubocop-rake (0.6.0)
104
104
  rubocop (~> 1.0)
105
- rubocop-rspec (2.29.2)
105
+ rubocop-rspec (2.31.0)
106
106
  rubocop (~> 1.40)
107
107
  rubocop-capybara (~> 2.17)
108
108
  rubocop-factory_bot (~> 2.22)
109
109
  rubocop-rspec_rails (~> 2.28)
110
- rubocop-rspec_rails (2.28.3)
111
- rubocop (~> 1.40)
110
+ rubocop-rspec_rails (2.29.1)
111
+ rubocop (~> 1.61)
112
112
  ruby-progressbar (1.13.0)
113
113
  simplecov (0.22.0)
114
114
  docile (~> 1.1)
@@ -121,12 +121,12 @@ GEM
121
121
  concurrent-ruby (~> 1.0)
122
122
  unicode-display_width (2.5.0)
123
123
  uri (0.13.0)
124
- webmock (3.23.0)
124
+ webmock (3.23.1)
125
125
  addressable (>= 2.8.0)
126
126
  crack (>= 0.3.2)
127
127
  hashdiff (>= 0.4.0, < 2.0.0)
128
128
  yard (0.9.36)
129
- zeitwerk (2.6.14)
129
+ zeitwerk (2.6.16)
130
130
 
131
131
  PLATFORMS
132
132
  ruby
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '7.4.1'
6
+ VERSION = '7.5.0'
7
7
  end
8
8
  end
9
9
  end
@@ -107,6 +107,13 @@ module Dor
107
107
  Workflow::Response::Workflows.new(xml: xml)
108
108
  end
109
109
 
110
+ # Skips all steps in a WF
111
+ def skip_all(druid:, workflow:, note:)
112
+ xml = create_process_xml(name: 'skip-all', status: 'skipped', note: note)
113
+ response = requestor.request "objects/#{druid}/workflows/#{workflow}/skip-all", 'post', xml, content_type: 'application/xml'
114
+ Workflow::Response::Workflows.new(xml: response)
115
+ end
116
+
110
117
  # Get workflow names into an array for given PID
111
118
  # This method only works when this gem is used in a project that is configured to connect to DOR
112
119
  #
@@ -40,7 +40,7 @@ module Dor
40
40
  @requestor = Requestor.new(connection: connection || ConnectionFactory.build_connection(url, timeout: timeout, logger: logger))
41
41
  end
42
42
 
43
- delegate :create_workflow_by_name, :workflow_status, :workflows, :all_workflows,
43
+ delegate :create_workflow_by_name, :workflow_status, :workflows, :all_workflows, :skip_all,
44
44
  :workflow, :process, :delete_workflow, :delete_all_workflows, :update_status, :update_error_status,
45
45
  to: :workflow_routes
46
46
 
@@ -49,8 +49,6 @@ module Dor
49
49
  delegate :lane_ids, :objects_for_workstep,
50
50
  to: :queues
51
51
 
52
- delegate :close_version, to: :version_routes
53
-
54
52
  def queues
55
53
  @queues ||= Queues.new(requestor: requestor)
56
54
  end
@@ -63,10 +61,6 @@ module Dor
63
61
  @lifecycle_routes ||= LifecycleRoutes.new(requestor: requestor)
64
62
  end
65
63
 
66
- def version_routes
67
- @version_routes ||= VersionRoutes.new(requestor: requestor)
68
- end
69
-
70
64
  def workflow_template(name)
71
65
  templates.retrieve(name)
72
66
  end
@@ -156,6 +156,22 @@ RSpec.describe Dor::Workflow::Client::WorkflowRoutes do
156
156
  end
157
157
  end
158
158
 
159
+ describe '#skip_all' do
160
+ subject(:skip_all) do
161
+ routes.skip_all(druid: 'druid:mw971zk1113', note: 'test note', workflow: 'ocrWF')
162
+ end
163
+
164
+ let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: nil) }
165
+
166
+ it 'sends a skip all request' do
167
+ skip_all
168
+ expect(mock_requestor).to have_received(:request)
169
+ .with('objects/druid:mw971zk1113/workflows/ocrWF/skip-all', 'post',
170
+ "<?xml version=\"1.0\"?>\n<process name=\"skip-all\" status=\"skipped\" note=\"test note\"/>\n",
171
+ { content_type: 'application/xml' })
172
+ end
173
+ end
174
+
159
175
  describe '#all_workflows' do
160
176
  let(:xml) do
161
177
  <<~XML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.1
4
+ version: 7.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-23 00:00:00.000000000 Z
12
+ date: 2024-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -130,7 +130,6 @@ files:
130
130
  - lib/dor/workflow/client/requestor.rb
131
131
  - lib/dor/workflow/client/status.rb
132
132
  - lib/dor/workflow/client/version.rb
133
- - lib/dor/workflow/client/version_routes.rb
134
133
  - lib/dor/workflow/client/workflow_routes.rb
135
134
  - lib/dor/workflow/client/workflow_template.rb
136
135
  - lib/dor/workflow/response/process.rb
@@ -142,7 +141,6 @@ files:
142
141
  - spec/dor/workflow/client/lifecycle_routes_spec.rb
143
142
  - spec/dor/workflow/client/requestor_spec.rb
144
143
  - spec/dor/workflow/client/status_spec.rb
145
- - spec/dor/workflow/client/version_routes_spec.rb
146
144
  - spec/dor/workflow/client/workflow_routes_spec.rb
147
145
  - spec/dor/workflow/client/workflow_template_spec.rb
148
146
  - spec/dor/workflow/client_spec.rb
@@ -169,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
167
  - !ruby/object:Gem::Version
170
168
  version: '0'
171
169
  requirements: []
172
- rubygems_version: 3.5.9
170
+ rubygems_version: 3.5.10
173
171
  signing_key:
174
172
  specification_version: 4
175
173
  summary: Provides convenience methods to work with the DOR Workflow Service
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- module Workflow
5
- class Client
6
- # Makes requests relating to versions
7
- class VersionRoutes
8
- def initialize(requestor:)
9
- @requestor = requestor
10
- end
11
-
12
- # Calls the versionClose endpoint of the workflow service:
13
- #
14
- # - completes the versioningWF:submit-version and versioningWF:start-accession steps
15
- # - initiates accesssionWF
16
- #
17
- # @param [String] druid The id of the object to delete the workflow from
18
- # @param [Boolean] create_accession_wf Option to create accessionWF when closing a version. Defaults to true
19
- def close_version(druid:, version:, create_accession_wf: true)
20
- requestor.request(construct_url(druid, version, create_accession_wf), 'post', '')
21
- true
22
- end
23
-
24
- private
25
-
26
- attr_reader :requestor
27
-
28
- def construct_url(druid, version, create_accession_wf)
29
- url = "objects/#{druid}/versionClose"
30
-
31
- qs_args = []
32
- qs_args << "version=#{version}" if version
33
- qs_args << 'create-accession=false' unless create_accession_wf
34
- url += "?#{qs_args.join('&')}" unless qs_args.empty?
35
- url
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Dor::Workflow::Client::VersionRoutes do
6
- let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: nil) }
7
-
8
- let(:routes) { described_class.new(requestor: mock_requestor) }
9
-
10
- let(:repo) { 'dor' }
11
-
12
- let(:druid) { 'druid:123' }
13
-
14
- describe '#close_version' do
15
- context 'with kwargs' do
16
- it 'passes version' do
17
- routes.close_version(druid: druid, version: 3)
18
- expect(mock_requestor).to have_received(:request)
19
- .with('objects/druid:123/versionClose?version=3', 'post', '')
20
- end
21
-
22
- it 'optionally prevents creation of accessionWF and passes version' do
23
- routes.close_version(druid: druid, create_accession_wf: false, version: 3)
24
- expect(mock_requestor).to have_received(:request)
25
- .with('objects/druid:123/versionClose?version=3&create-accession=false', 'post', '')
26
- end
27
- end
28
- end
29
- end