dor-services-client 15.16.0 → 15.17.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/response/workflow.rb +14 -6
- data/lib/dor/services/response/workflows.rb +7 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08d442e83ffd620ca6ce507912bfad7ece5ce2e303c05dbfa09753828b348f17'
|
4
|
+
data.tar.gz: 7da84b625648e7dfaef778ece349cea18d5e25b5ebd49163e33aa223920d81ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 957c36d544c0708e407885b10f5eb2d5c82dff88a4635800d90ad1d3371563d6b63147f2674c9678d2d6049d3289046632c631d337eab04e3b6e427e4b381f53
|
7
|
+
data.tar.gz: ba46d21dda5de8a2a614c014fc26ad7287e6de283c5285ffbec4661090c529c3df9cb4333ba22e7ae5188b9360b2d68f5255f1d50524ce9e62019bab5a6800b1
|
data/Gemfile.lock
CHANGED
@@ -24,7 +24,12 @@ module Dor
|
|
24
24
|
result ? true : false
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
def error_count
|
28
|
+
process_names.map { |process_name| process_for_recent_version(name: process_name) }
|
29
|
+
.count { |process| process.status == 'error' }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the process for the most recent version that matches the given name:
|
28
33
|
def process_for_recent_version(name:)
|
29
34
|
nodes = process_nodes_for(name: name)
|
30
35
|
node = nodes.max { |a, b| a.attr('version').to_i <=> b.attr('version').to_i }
|
@@ -38,12 +43,11 @@ module Dor
|
|
38
43
|
# Check if all processes are skipped or complete for the provided version.
|
39
44
|
# @param [Integer] version the version we are checking for.
|
40
45
|
def complete_for?(version:)
|
41
|
-
# ng_xml.xpath("/workflow/process[@version=#{version}]/@status").map(&:value).all? { |p| %w[skipped completed].include?(p) }
|
42
46
|
incomplete_processes_for(version: version).empty?
|
43
47
|
end
|
44
48
|
|
45
49
|
def complete?
|
46
|
-
complete_for?(version:
|
50
|
+
complete_for?(version: latest_version)
|
47
51
|
end
|
48
52
|
|
49
53
|
def incomplete_processes_for(version:)
|
@@ -53,15 +57,15 @@ module Dor
|
|
53
57
|
end
|
54
58
|
|
55
59
|
def incomplete_processes
|
56
|
-
incomplete_processes_for(version:
|
60
|
+
incomplete_processes_for(version: latest_version)
|
57
61
|
end
|
58
62
|
|
59
63
|
attr_reader :xml
|
60
64
|
|
61
65
|
private
|
62
66
|
|
63
|
-
# Return the
|
64
|
-
def
|
67
|
+
# Return the latest version in this workflow document
|
68
|
+
def latest_version
|
65
69
|
ng_xml.xpath('/workflow/process/@version').map { |attr| attr.value.to_i }.max
|
66
70
|
end
|
67
71
|
|
@@ -81,6 +85,10 @@ module Dor
|
|
81
85
|
attributes = node ? node.attributes.to_h { |k, v| [k.to_sym, v.value] } : {}
|
82
86
|
Process.new(parent: self, **attributes)
|
83
87
|
end
|
88
|
+
|
89
|
+
def process_names(version: latest_version)
|
90
|
+
ng_xml.xpath("/workflow/process[@version=#{version}]").map { |process| process['name'] }
|
91
|
+
end
|
84
92
|
end
|
85
93
|
end
|
86
94
|
end
|
@@ -5,32 +5,26 @@ module Dor
|
|
5
5
|
module Response
|
6
6
|
# The response from asking the server about all workflows for an item
|
7
7
|
class Workflows
|
8
|
+
attr_reader :xml
|
9
|
+
|
10
|
+
# @param [Nokogiri::XML] xml Nokogiri XML document showing all workflows
|
8
11
|
def initialize(xml:)
|
9
12
|
@xml = xml
|
10
13
|
end
|
11
14
|
|
12
15
|
def pid
|
13
|
-
|
16
|
+
xml.at_xpath('/workflows/@objectId').text
|
14
17
|
end
|
15
18
|
|
16
19
|
def workflows
|
17
|
-
@workflows ||=
|
20
|
+
@workflows ||= xml.xpath('/workflows/workflow').map do |node|
|
18
21
|
Workflow.new(xml: node.to_xml)
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
22
|
-
# @return [Array<String>] returns a list of errors for any process for the
|
25
|
+
# @return [Array<String>] returns a list of errors for any process for the specified version
|
23
26
|
def errors_for(version:)
|
24
|
-
|
25
|
-
.map(&:text)
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :xml
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def ng_xml
|
33
|
-
@ng_xml ||= Nokogiri::XML(@xml)
|
27
|
+
xml.xpath("//workflow/process[@version='#{version}' and @status='error']/@errorMessage").map(&:text)
|
34
28
|
end
|
35
29
|
end
|
36
30
|
end
|