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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b29586cf5f0f5d2fd768d99ae4533af1d29e1879daa96b1e5611e09ef8195ff
4
- data.tar.gz: 74c7641b0e942528005d65318116702a5cba4171b6f833f2ec46aa3065619ac7
3
+ metadata.gz: f09cfcba6518009d57900ff9c069be55dab613542f38cb948d503c8bd2754ba6
4
+ data.tar.gz: e446798dbeedc9a88784622598ff21b22ae2246a70cb392b2a7842afe08889a3
5
5
  SHA512:
6
- metadata.gz: 46e27f180e3df6018706a9f01051ff09e757795bdc76e013ff8e493a01ba45a639f054a0fefa55f340e3aa054c7458eb4fc82acc8233f2c28208a8476e17c5b3
7
- data.tar.gz: 9597f00cc9074bac61867dd441b2d96150ce814763c2d5e25b84e3741b905a0233f5a96e1061f61ba0f43aef13a5aebb57f18f9911d12026c7e51acc78ffc832
6
+ metadata.gz: a45a0cea334788ad551560bc29250e3e37ad2dc17eca40305804e181178815632537ba6ff1ea99147fb292c154605fd0a68dc53a8fadcc06240bb73d4526b4cd
7
+ data.tar.gz: 7b4319b9e0bdafc9c08033de8dec348c5bc5204a0798038516415371d819ba6dec4563b07b1497142764f0d6740a28ebb84245947e43391aa0a7b7d98215650b
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.2
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.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.1.3.3)
15
+ activesupport (7.2.2)
16
16
  base64
17
+ benchmark (>= 0.3)
17
18
  bigdecimal
18
- concurrent-ruby (~> 1.0, >= 1.0.2)
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
- mutex_m
24
- tzinfo (~> 2.0)
25
- addressable (2.8.6)
26
- public_suffix (>= 2.0.2, < 6.0)
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.2.3)
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.0)
42
+ docile (1.4.1)
40
43
  drb (2.2.1)
41
- faraday (2.9.0)
42
- faraday-net_http (>= 2.0, < 3.2)
43
- faraday-net_http (3.1.0)
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.0)
48
- i18n (1.14.5)
52
+ hashdiff (1.1.1)
53
+ i18n (1.14.6)
49
54
  concurrent-ruby (~> 1.0)
50
- json (2.7.2)
55
+ json (2.7.5)
51
56
  language_server-protocol (3.17.0.3)
52
- mini_portile2 (2.8.6)
53
- minitest (5.23.0)
54
- mutex_m (0.2.0)
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.5)
62
+ nokogiri (1.16.7)
58
63
  mini_portile2 (~> 2.8.2)
59
64
  racc (~> 1.4)
60
- parallel (1.24.0)
61
- parser (3.3.1.0)
65
+ parallel (1.26.3)
66
+ parser (3.3.5.0)
62
67
  ast (~> 2.4.1)
63
68
  racc
64
- public_suffix (5.0.5)
65
- racc (1.8.0)
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.2.8)
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.0)
79
+ rspec-core (3.13.2)
76
80
  rspec-support (~> 3.13.0)
77
- rspec-expectations (3.13.0)
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.1)
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.63.5)
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 (>= 1.8, < 3.0)
93
- rexml (>= 3.2.5, < 4.0)
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.31.3)
100
+ rubocop-ast (1.33.0)
98
101
  parser (>= 3.3.1.0)
99
- rubocop-capybara (2.20.0)
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.29.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.28.3)
111
- rubocop (~> 1.40)
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.12.3)
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.5.0)
123
- uri (0.13.0)
124
- webmock (3.23.0)
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.36)
129
- zeitwerk (2.6.14)
131
+ yard (0.9.37)
132
+ zeitwerk (2.7.1)
130
133
 
131
134
  PLATFORMS
132
135
  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.6.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
  #
@@ -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.1
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-05-23 00:00:00.000000000 Z
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.9
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