dor-workflow-client 7.4.1 → 7.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/Gemfile.lock +49 -46
- data/lib/dor/workflow/client/version.rb +1 -1
- data/lib/dor/workflow/client/workflow_routes.rb +7 -0
- data/lib/dor/workflow/client.rb +2 -8
- data/spec/dor/workflow/client/workflow_routes_spec.rb +16 -0
- metadata +3 -5
- data/lib/dor/workflow/client/version_routes.rb +0 -40
- data/spec/dor/workflow/client/version_routes_spec.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f09cfcba6518009d57900ff9c069be55dab613542f38cb948d503c8bd2754ba6
|
4
|
+
data.tar.gz: e446798dbeedc9a88784622598ff21b22ae2246a70cb392b2a7842afe08889a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a45a0cea334788ad551560bc29250e3e37ad2dc17eca40305804e181178815632537ba6ff1ea99147fb292c154605fd0a68dc53a8fadcc06240bb73d4526b4cd
|
7
|
+
data.tar.gz: 7b4319b9e0bdafc9c08033de8dec348c5bc5204a0798038516415371d819ba6dec4563b07b1497142764f0d6740a28ebb84245947e43391aa0a7b7d98215650b
|
data/.circleci/config.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dor-workflow-client (7.
|
4
|
+
dor-workflow-client (7.6.0)
|
5
5
|
activesupport (>= 3.2.1, < 8)
|
6
6
|
deprecation (>= 0.99.0)
|
7
7
|
faraday (~> 2.0)
|
@@ -12,23 +12,26 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (7.
|
15
|
+
activesupport (7.2.2)
|
16
16
|
base64
|
17
|
+
benchmark (>= 0.3)
|
17
18
|
bigdecimal
|
18
|
-
concurrent-ruby (~> 1.0, >= 1.
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
19
20
|
connection_pool (>= 2.2.5)
|
20
21
|
drb
|
21
22
|
i18n (>= 1.6, < 2)
|
23
|
+
logger (>= 1.4.2)
|
22
24
|
minitest (>= 5.1)
|
23
|
-
|
24
|
-
tzinfo (~> 2.0)
|
25
|
-
addressable (2.8.
|
26
|
-
public_suffix (>= 2.0.2, <
|
25
|
+
securerandom (>= 0.3)
|
26
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
27
|
+
addressable (2.8.7)
|
28
|
+
public_suffix (>= 2.0.2, < 7.0)
|
27
29
|
ast (2.4.2)
|
28
30
|
base64 (0.2.0)
|
31
|
+
benchmark (0.3.0)
|
29
32
|
bigdecimal (3.1.8)
|
30
33
|
byebug (11.1.3)
|
31
|
-
concurrent-ruby (1.
|
34
|
+
concurrent-ruby (1.3.4)
|
32
35
|
connection_pool (2.4.1)
|
33
36
|
crack (1.0.0)
|
34
37
|
bigdecimal
|
@@ -36,97 +39,97 @@ GEM
|
|
36
39
|
deprecation (1.1.0)
|
37
40
|
activesupport
|
38
41
|
diff-lcs (1.5.1)
|
39
|
-
docile (1.4.
|
42
|
+
docile (1.4.1)
|
40
43
|
drb (2.2.1)
|
41
|
-
faraday (2.
|
42
|
-
faraday-net_http (>= 2.0, < 3.
|
43
|
-
|
44
|
+
faraday (2.12.0)
|
45
|
+
faraday-net_http (>= 2.0, < 3.4)
|
46
|
+
json
|
47
|
+
logger
|
48
|
+
faraday-net_http (3.3.0)
|
44
49
|
net-http
|
45
50
|
faraday-retry (2.2.1)
|
46
51
|
faraday (~> 2.0)
|
47
|
-
hashdiff (1.1.
|
48
|
-
i18n (1.14.
|
52
|
+
hashdiff (1.1.1)
|
53
|
+
i18n (1.14.6)
|
49
54
|
concurrent-ruby (~> 1.0)
|
50
|
-
json (2.7.
|
55
|
+
json (2.7.5)
|
51
56
|
language_server-protocol (3.17.0.3)
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
logger (1.6.1)
|
58
|
+
mini_portile2 (2.8.7)
|
59
|
+
minitest (5.25.1)
|
55
60
|
net-http (0.4.1)
|
56
61
|
uri
|
57
|
-
nokogiri (1.16.
|
62
|
+
nokogiri (1.16.7)
|
58
63
|
mini_portile2 (~> 2.8.2)
|
59
64
|
racc (~> 1.4)
|
60
|
-
parallel (1.
|
61
|
-
parser (3.3.
|
65
|
+
parallel (1.26.3)
|
66
|
+
parser (3.3.5.0)
|
62
67
|
ast (~> 2.4.1)
|
63
68
|
racc
|
64
|
-
public_suffix (
|
65
|
-
racc (1.8.
|
69
|
+
public_suffix (6.0.1)
|
70
|
+
racc (1.8.1)
|
66
71
|
rainbow (3.1.1)
|
67
72
|
rake (13.2.1)
|
68
73
|
regexp_parser (2.9.2)
|
69
|
-
rexml (3.
|
70
|
-
strscan (>= 3.0.9)
|
74
|
+
rexml (3.3.9)
|
71
75
|
rspec (3.13.0)
|
72
76
|
rspec-core (~> 3.13.0)
|
73
77
|
rspec-expectations (~> 3.13.0)
|
74
78
|
rspec-mocks (~> 3.13.0)
|
75
|
-
rspec-core (3.13.
|
79
|
+
rspec-core (3.13.2)
|
76
80
|
rspec-support (~> 3.13.0)
|
77
|
-
rspec-expectations (3.13.
|
81
|
+
rspec-expectations (3.13.3)
|
78
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
79
83
|
rspec-support (~> 3.13.0)
|
80
|
-
rspec-mocks (3.13.
|
84
|
+
rspec-mocks (3.13.2)
|
81
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
86
|
rspec-support (~> 3.13.0)
|
83
87
|
rspec-support (3.13.1)
|
84
88
|
rspec_junit_formatter (0.6.0)
|
85
89
|
rspec-core (>= 2, < 4, != 2.12.0)
|
86
|
-
rubocop (1.
|
90
|
+
rubocop (1.68.0)
|
87
91
|
json (~> 2.3)
|
88
92
|
language_server-protocol (>= 3.17.0)
|
89
93
|
parallel (~> 1.10)
|
90
94
|
parser (>= 3.3.0.2)
|
91
95
|
rainbow (>= 2.2.2, < 4.0)
|
92
|
-
regexp_parser (>=
|
93
|
-
|
94
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
96
|
+
regexp_parser (>= 2.4, < 3.0)
|
97
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
95
98
|
ruby-progressbar (~> 1.7)
|
96
99
|
unicode-display_width (>= 2.4.0, < 3.0)
|
97
|
-
rubocop-ast (1.
|
100
|
+
rubocop-ast (1.33.0)
|
98
101
|
parser (>= 3.3.1.0)
|
99
|
-
rubocop-capybara (2.
|
100
|
-
rubocop (~> 1.41)
|
101
|
-
rubocop-factory_bot (2.25.1)
|
102
|
+
rubocop-capybara (2.21.0)
|
102
103
|
rubocop (~> 1.41)
|
104
|
+
rubocop-factory_bot (2.26.1)
|
105
|
+
rubocop (~> 1.61)
|
103
106
|
rubocop-rake (0.6.0)
|
104
107
|
rubocop (~> 1.0)
|
105
|
-
rubocop-rspec (2.
|
108
|
+
rubocop-rspec (2.31.0)
|
106
109
|
rubocop (~> 1.40)
|
107
110
|
rubocop-capybara (~> 2.17)
|
108
111
|
rubocop-factory_bot (~> 2.22)
|
109
112
|
rubocop-rspec_rails (~> 2.28)
|
110
|
-
rubocop-rspec_rails (2.
|
111
|
-
rubocop (~> 1.
|
113
|
+
rubocop-rspec_rails (2.29.1)
|
114
|
+
rubocop (~> 1.61)
|
112
115
|
ruby-progressbar (1.13.0)
|
116
|
+
securerandom (0.3.1)
|
113
117
|
simplecov (0.22.0)
|
114
118
|
docile (~> 1.1)
|
115
119
|
simplecov-html (~> 0.11)
|
116
120
|
simplecov_json_formatter (~> 0.1)
|
117
|
-
simplecov-html (0.
|
121
|
+
simplecov-html (0.13.1)
|
118
122
|
simplecov_json_formatter (0.1.4)
|
119
|
-
strscan (3.1.0)
|
120
123
|
tzinfo (2.0.6)
|
121
124
|
concurrent-ruby (~> 1.0)
|
122
|
-
unicode-display_width (2.
|
123
|
-
uri (0.13.
|
124
|
-
webmock (3.
|
125
|
+
unicode-display_width (2.6.0)
|
126
|
+
uri (0.13.1)
|
127
|
+
webmock (3.24.0)
|
125
128
|
addressable (>= 2.8.0)
|
126
129
|
crack (>= 0.3.2)
|
127
130
|
hashdiff (>= 0.4.0, < 2.0.0)
|
128
|
-
yard (0.9.
|
129
|
-
zeitwerk (2.
|
131
|
+
yard (0.9.37)
|
132
|
+
zeitwerk (2.7.1)
|
130
133
|
|
131
134
|
PLATFORMS
|
132
135
|
ruby
|
@@ -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
|
#
|
data/lib/dor/workflow/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Dor
|
|
25
25
|
# Create and update workflows
|
26
26
|
class Client
|
27
27
|
# From workflow-server-rails' app/models/workflow_step.rb
|
28
|
-
VALID_STATUS = %w[waiting completed error queued skipped started].freeze
|
28
|
+
VALID_STATUS = %w[waiting completed error queued skipped started retrying].freeze
|
29
29
|
|
30
30
|
attr_accessor :requestor
|
31
31
|
|
@@ -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
|
+
version: 7.6.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-
|
12
|
+
date: 2024-10-31 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.
|
170
|
+
rubygems_version: 3.5.11
|
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
|