dor-workflow-client 7.0.2 → 7.2.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: f6b39aa68d201501560723248e1227a926a054bef2b9d0bd52fb838bfe59b4ab
4
- data.tar.gz: d5ec6e469fa8caf1ab3bd89f284000bdf0a1a99ea5e076de92b3a9c6e03d46ee
3
+ metadata.gz: 29157476de970bf333e7ca643d49b79ef4e03cf0bf9e18aab8277767492aab3f
4
+ data.tar.gz: c25c23a411be47575be4c3d91e912c4d5b48b698423d302d8263a7ca0f1170f7
5
5
  SHA512:
6
- metadata.gz: ee3c55767e033f381642b56af7b2b783598b818798d85b6106b3d7defcccb39a6942e2daa3a7abde0133f5e5664bd9927abee6549919d17e35ff52c89b04267e
7
- data.tar.gz: c213c42ee4cd545bf81b9104f74449f15af44a947d5e546e4dfd2cde240c0cc0d468bf6b55b3cd94b22517c931922f97ef6f67c1f62445ee32e8df080172e812
6
+ metadata.gz: 32b74f669d2ec51717389c34e6ab113f1271ba05b84f3a9ac5a2e5e95da562ada8d2e7cb85ed78a8d4c80e14862e7658b15bf18b9933f0be4223933d80dcc0c2
7
+ data.tar.gz: af1f2bbbb802ebd84ccb239ea62e29b8bfdfb3a0947d0729a9e16caea8594b9bc224750085674b28c7448ff47f4fd8525830b8627ad5dab2f31f0c861d8dafcd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-workflow-client (7.0.2)
4
+ dor-workflow-client (7.2.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
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.4)
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
@@ -10,26 +10,24 @@ module Dor
10
10
  0 => 'Unknown Status', # if there are no milestones for the current version, someone likely messed up the versioning process.
11
11
  1 => 'Registered',
12
12
  2 => 'In accessioning',
13
- 3 => 'In accessioning (described)',
14
- 4 => 'In accessioning (described, published)',
15
- 5 => 'In accessioning (described, published, deposited)',
16
- 6 => 'Accessioned',
17
- 7 => 'Accessioned (indexed)',
18
- 8 => 'Accessioned (indexed, ingested)',
19
- 9 => 'Opened'
13
+ 3 => 'In accessioning (published)',
14
+ 4 => 'In accessioning (published, deposited)',
15
+ 5 => 'Accessioned',
16
+ 6 => 'Accessioned (indexed)',
17
+ 7 => 'Accessioned (indexed, ingested)',
18
+ 8 => 'Opened'
20
19
  }.freeze
21
20
 
22
21
  # milestones from accessioning and the order they happen in
23
22
  STEPS = {
24
23
  'registered' => 1,
25
24
  'submitted' => 2,
26
- 'described' => 3,
27
- 'published' => 4,
28
- 'deposited' => 5,
29
- 'accessioned' => 6,
30
- 'indexed' => 7,
31
- 'shelved' => 8,
32
- 'opened' => 9
25
+ 'published' => 3,
26
+ 'deposited' => 4,
27
+ 'accessioned' => 5,
28
+ 'indexed' => 6,
29
+ 'shelved' => 7,
30
+ 'opened' => 8
33
31
  }.freeze
34
32
 
35
33
  attr_reader :status_code
@@ -78,7 +76,7 @@ module Dor
78
76
  end
79
77
 
80
78
  # @return [String] text translation of the status code, minus any trailing parenthetical explanation
81
- # e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both return 'In accessioning'
79
+ # e.g. 'Accessioned (indexed)' and 'Accessioned (indexed, ingested)', both return 'Accessioned'
82
80
  def simplified_status_code(display)
83
81
  display.gsub(/\(.*\)$/, '').strip
84
82
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '7.0.2'
6
+ VERSION = '7.2.0'
7
7
  end
8
8
  end
9
9
  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
@@ -32,7 +32,7 @@ RSpec.describe Dor::Workflow::Client::Status do
32
32
  let(:version) { '4' }
33
33
 
34
34
  it 'generates a status string' do
35
- expect(status).to eq('v4 In accessioning (described, published)')
35
+ expect(status).to eq('v4 In accessioning (published)')
36
36
  end
37
37
  end
38
38
 
@@ -47,7 +47,7 @@ RSpec.describe Dor::Workflow::Client::Status do
47
47
  let(:version) { '3' }
48
48
 
49
49
  it 'generates a status string' do
50
- expect(status).to eq('v3 In accessioning (described, published)')
50
+ expect(status).to eq('v3 In accessioning (published)')
51
51
  end
52
52
  end
53
53
  end
@@ -177,7 +177,7 @@ RSpec.describe Dor::Workflow::Client::Status do
177
177
  end
178
178
 
179
179
  it 'has the correct status of deposited (v2) object' do
180
- expect(status).to eq('v2 In accessioning (described, published, deposited) 2013-10-01 07:10PM')
180
+ expect(status).to eq('v2 In accessioning (published, deposited) 2013-10-01 07:10PM')
181
181
  end
182
182
  end
183
183
  end
@@ -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.2
4
+ version: 7.2.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.4.10
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Provides convenience methods to work with the DOR Workflow Service