dor-workflow-client 7.0.1 → 7.1.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: bec7fdf12fdbda526eb0cea1d89fde04626a8589b09c1737b5d3bf085a57bcbc
4
- data.tar.gz: f6b8e662f70cdd9977bdda365391a1fbe96eca213b8d0dfdf09c407ef635480a
3
+ metadata.gz: 2691ff10a4a127beadce86389243d3bc13db82ef745a53bf030c50ea85d75f40
4
+ data.tar.gz: e5872d67e32db69fc53cdf843f394be3f384c8fa5f4f0cd931cc9a04286ae16e
5
5
  SHA512:
6
- metadata.gz: fea03cec5f39ed246decc53a87f14601df480443f0cdcb4f87dee0ffbaafb7e06d5bc85d39e7125c3ac17a9d0464f97c71f65205a2d0cd5d8c12d9bfee75494d
7
- data.tar.gz: 5274a94c239f252ace6d324092a954c5f901522514323b11a0dd39fcc94073b8b81c38818a9e0dd350d80201c4f49412740eb45b3871bf87889ead10a1bf49f0
6
+ metadata.gz: 1ac0df9fb64bc20d641cdc58874fab21b00dee008075d71b5105834495ebc9d191b21196ab6dfe7a72e891ce1761f8679bd41bbce76846820f8ff973f50884a9
7
+ data.tar.gz: 1209cbb67b48e24bdb48bdffb8976c8048c5465b12e2468ea42eb91b6e475a7dc3616e8805727a94e155e266d9adf48eccbac7441788681e8a84cc112fc476ad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-workflow-client (7.0.1)
4
+ dor-workflow-client (7.1.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.2)
15
+ activesupport (7.1.3.2)
16
16
  base64
17
17
  bigdecimal
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -26,18 +26,18 @@ GEM
26
26
  public_suffix (>= 2.0.2, < 6.0)
27
27
  ast (2.4.2)
28
28
  base64 (0.2.0)
29
- bigdecimal (3.1.5)
29
+ bigdecimal (3.1.7)
30
30
  byebug (11.1.3)
31
- concurrent-ruby (1.2.2)
31
+ concurrent-ruby (1.2.3)
32
32
  connection_pool (2.4.1)
33
- crack (0.4.5)
33
+ crack (1.0.0)
34
+ bigdecimal
34
35
  rexml
35
36
  deprecation (1.1.0)
36
37
  activesupport
37
- diff-lcs (1.5.0)
38
+ diff-lcs (1.5.1)
38
39
  docile (1.4.0)
39
- drb (2.2.0)
40
- ruby2_keywords
40
+ drb (2.2.1)
41
41
  faraday (2.9.0)
42
42
  faraday-net_http (>= 2.0, < 3.2)
43
43
  faraday-net_http (3.1.0)
@@ -45,20 +45,20 @@ GEM
45
45
  faraday-retry (2.2.0)
46
46
  faraday (~> 2.0)
47
47
  hashdiff (1.1.0)
48
- i18n (1.14.1)
48
+ i18n (1.14.4)
49
49
  concurrent-ruby (~> 1.0)
50
50
  json (2.7.1)
51
51
  language_server-protocol (3.17.0.3)
52
52
  mini_portile2 (2.8.5)
53
- minitest (5.21.1)
53
+ minitest (5.22.3)
54
54
  mutex_m (0.2.0)
55
55
  net-http (0.4.1)
56
56
  uri
57
- nokogiri (1.16.0)
57
+ nokogiri (1.16.3)
58
58
  mini_portile2 (~> 2.8.2)
59
59
  racc (~> 1.4)
60
60
  parallel (1.24.0)
61
- parser (3.3.0.3)
61
+ parser (3.3.0.5)
62
62
  ast (~> 2.4.1)
63
63
  racc
64
64
  public_suffix (5.0.4)
@@ -67,22 +67,22 @@ GEM
67
67
  rake (13.1.0)
68
68
  regexp_parser (2.9.0)
69
69
  rexml (3.2.6)
70
- rspec (3.12.0)
71
- rspec-core (~> 3.12.0)
72
- rspec-expectations (~> 3.12.0)
73
- rspec-mocks (~> 3.12.0)
74
- rspec-core (3.12.2)
75
- rspec-support (~> 3.12.0)
76
- rspec-expectations (3.12.3)
70
+ rspec (3.13.0)
71
+ rspec-core (~> 3.13.0)
72
+ rspec-expectations (~> 3.13.0)
73
+ rspec-mocks (~> 3.13.0)
74
+ rspec-core (3.13.0)
75
+ rspec-support (~> 3.13.0)
76
+ rspec-expectations (3.13.0)
77
77
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.12.0)
79
- rspec-mocks (3.12.6)
78
+ rspec-support (~> 3.13.0)
79
+ rspec-mocks (3.13.0)
80
80
  diff-lcs (>= 1.2.0, < 2.0)
81
- rspec-support (~> 3.12.0)
82
- rspec-support (3.12.1)
81
+ rspec-support (~> 3.13.0)
82
+ rspec-support (3.13.1)
83
83
  rspec_junit_formatter (0.6.0)
84
84
  rspec-core (>= 2, < 4, != 2.12.0)
85
- rubocop (1.60.0)
85
+ rubocop (1.62.1)
86
86
  json (~> 2.3)
87
87
  language_server-protocol (>= 3.17.0)
88
88
  parallel (~> 1.10)
@@ -90,23 +90,25 @@ GEM
90
90
  rainbow (>= 2.2.2, < 4.0)
91
91
  regexp_parser (>= 1.8, < 3.0)
92
92
  rexml (>= 3.2.5, < 4.0)
93
- rubocop-ast (>= 1.30.0, < 2.0)
93
+ rubocop-ast (>= 1.31.1, < 2.0)
94
94
  ruby-progressbar (~> 1.7)
95
95
  unicode-display_width (>= 2.4.0, < 3.0)
96
- rubocop-ast (1.30.0)
97
- parser (>= 3.2.1.0)
96
+ rubocop-ast (1.31.2)
97
+ parser (>= 3.3.0.4)
98
98
  rubocop-capybara (2.20.0)
99
99
  rubocop (~> 1.41)
100
100
  rubocop-factory_bot (2.25.1)
101
101
  rubocop (~> 1.41)
102
102
  rubocop-rake (0.6.0)
103
103
  rubocop (~> 1.0)
104
- rubocop-rspec (2.26.1)
104
+ rubocop-rspec (2.28.0)
105
105
  rubocop (~> 1.40)
106
106
  rubocop-capybara (~> 2.17)
107
107
  rubocop-factory_bot (~> 2.22)
108
+ rubocop-rspec_rails (~> 2.28)
109
+ rubocop-rspec_rails (2.28.2)
110
+ rubocop (~> 1.40)
108
111
  ruby-progressbar (1.13.0)
109
- ruby2_keywords (0.0.5)
110
112
  simplecov (0.22.0)
111
113
  docile (~> 1.1)
112
114
  simplecov-html (~> 0.11)
@@ -117,12 +119,12 @@ GEM
117
119
  concurrent-ruby (~> 1.0)
118
120
  unicode-display_width (2.5.0)
119
121
  uri (0.13.0)
120
- webmock (3.19.1)
122
+ webmock (3.23.0)
121
123
  addressable (>= 2.8.0)
122
124
  crack (>= 0.3.2)
123
125
  hashdiff (>= 0.4.0, < 2.0.0)
124
- yard (0.9.34)
125
- zeitwerk (2.6.12)
126
+ yard (0.9.36)
127
+ zeitwerk (2.6.13)
126
128
 
127
129
  PLATFORMS
128
130
  ruby
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '7.0.1'
6
+ VERSION = '7.1.0'
7
7
  end
8
8
  end
9
9
  end
@@ -71,6 +71,10 @@ module Dor
71
71
  templates.retrieve(name)
72
72
  end
73
73
 
74
+ def workflow_templates
75
+ templates.all
76
+ end
77
+
74
78
  def templates
75
79
  WorkflowTemplate.new(requestor: requestor)
76
80
  end
@@ -17,6 +17,7 @@ module Dor
17
17
  workflow['id']
18
18
  end
19
19
 
20
+ # Check if there are any processes for the provided version.
20
21
  # @param [Integer] version the version we are checking for.
21
22
  def active_for?(version:)
22
23
  result = ng_xml.at_xpath("/workflow/process[@version=#{version}]")
@@ -35,10 +36,16 @@ module Dor
35
36
  ng_xml.xpath('/workflow/process').empty?
36
37
  end
37
38
 
38
- def complete?
39
+ # Check if all processes are skipped or complete for the provided version.
40
+ # @param [Integer] version the version we are checking for.
41
+ def complete_for?(version:)
39
42
  ng_xml.xpath("/workflow/process[@version=#{version}]/@status").map(&:value).all? { |p| %w[skipped completed].include?(p) }
40
43
  end
41
44
 
45
+ def complete?
46
+ complete_for?(version: version)
47
+ end
48
+
42
49
  attr_reader :xml
43
50
 
44
51
  private
@@ -61,6 +61,31 @@ RSpec.describe Dor::Workflow::Response::Workflow do
61
61
  end
62
62
  end
63
63
 
64
+ describe '#complete_for?' do
65
+ let(:xml) do
66
+ <<~XML
67
+ <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
68
+ <process version="1" laneId="default" elapsed="0.0" attempts="1" datetime="2013-02-18T14:40:25-0800" status="completed" name="start-assembly"/>
69
+ <process version="1" laneId="default" elapsed="0.509" attempts="1" datetime="2013-02-18T14:42:24-0800" status="waiting" name="jp2-create"/>
70
+ <process version="2" laneId="default" elapsed="0.0" attempts="1" datetime="2013-02-18T14:40:25-0800" status="completed" name="start-assembly"/>
71
+ <process version="2" laneId="default" elapsed="0.509" attempts="1" datetime="2013-02-18T14:42:24-0800" status="completed" name="jp2-create"/>
72
+ </workflow>
73
+ XML
74
+ end
75
+
76
+ context 'when all steps are complete' do
77
+ it 'returns true' do
78
+ expect(instance.complete_for?(version: 2)).to be true
79
+ end
80
+ end
81
+
82
+ context 'when some steps are not complete' do
83
+ it 'returns false' do
84
+ expect(instance.complete_for?(version: 1)).to be false
85
+ end
86
+ end
87
+ end
88
+
64
89
  describe '#active_for?' do
65
90
  subject { instance.active_for?(version: 2) }
66
91
 
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.0.1
4
+ version: 7.1.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-01-16 00:00:00.000000000 Z
12
+ date: 2024-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.3.7
171
+ rubygems_version: 3.5.7
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Provides convenience methods to work with the DOR Workflow Service