dor-workflow-client 7.6.1 → 7.7.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: e00d33007a67fe3e607553f3fb0f51744cafc3bcda21d2d7bd07526d1821f199
4
- data.tar.gz: eba26125adda3619e00f5e8ec081dc2c861cf45b39993a70c011a79bea53ac48
3
+ metadata.gz: 12fc3722da54e3e3e25ef9bae87ac0fa5e492076fb88a532450fef9adebe5e52
4
+ data.tar.gz: 91113259c02396333c21190914fd79cdcfd66415dcf1b14e9859f2fe8e272084
5
5
  SHA512:
6
- metadata.gz: 4e1e7964e9432f5aa2d0af7a1729812ef0a5401501a89f9e73ad32a78f7dbc920d3d52ed28a3e583fb61d455f9e0cc21439cb55b2680d174843544d9e0e8441f
7
- data.tar.gz: 509627aa57a083d796534df08b9a39761a0615394ff34a6c730da357b9e59e6c55bdd525884d673b2e6b79ca308b7bac9076d8b3f9a07c4b397a9b5e827b6300
6
+ metadata.gz: 3521c9c4b2e0156f1ee8a559a7a61786ec441da04695da184be35a261349c895e8f11132a4687d1ca7db7b98993251ac1475cd95da12cfbbf2f2762ed3a447f7
7
+ data.tar.gz: ae4250842e3664aa3978f2ee405b8a217cd149aa5356b74c9a9b2dd0c164643505323271c07891b390f7358295ddc787fdfccc5beb7b361dff343a4573ffb748
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.2
3
+ ruby-rails: sul-dlss/ruby-rails@4.2.3
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.6.1)
4
+ dor-workflow-client (7.7.0)
5
5
  activesupport (>= 7.0.0)
6
6
  deprecation (>= 0.99.0)
7
7
  faraday (~> 2.0)
@@ -42,25 +42,25 @@ GEM
42
42
  diff-lcs (1.5.1)
43
43
  docile (1.4.1)
44
44
  drb (2.2.1)
45
- faraday (2.12.0)
46
- faraday-net_http (>= 2.0, < 3.4)
45
+ faraday (2.12.2)
46
+ faraday-net_http (>= 2.0, < 3.5)
47
47
  json
48
48
  logger
49
- faraday-net_http (3.3.0)
50
- net-http
49
+ faraday-net_http (3.4.0)
50
+ net-http (>= 0.5.0)
51
51
  faraday-retry (2.2.1)
52
52
  faraday (~> 2.0)
53
- hashdiff (1.1.1)
53
+ hashdiff (1.1.2)
54
54
  i18n (1.14.6)
55
55
  concurrent-ruby (~> 1.0)
56
- json (2.8.1)
56
+ json (2.9.0)
57
57
  language_server-protocol (3.17.0.3)
58
- logger (1.6.1)
59
- mini_portile2 (2.8.7)
60
- minitest (5.25.1)
61
- net-http (0.5.0)
58
+ logger (1.6.2)
59
+ mini_portile2 (2.8.8)
60
+ minitest (5.25.4)
61
+ net-http (0.6.0)
62
62
  uri
63
- nokogiri (1.16.7)
63
+ nokogiri (1.17.0)
64
64
  mini_portile2 (~> 2.8.2)
65
65
  racc (~> 1.4)
66
66
  parallel (1.26.3)
@@ -71,7 +71,7 @@ GEM
71
71
  racc (1.8.1)
72
72
  rainbow (3.1.1)
73
73
  rake (13.2.1)
74
- regexp_parser (2.9.2)
74
+ regexp_parser (2.9.3)
75
75
  rexml (3.3.9)
76
76
  rspec (3.13.0)
77
77
  rspec-core (~> 3.13.0)
@@ -85,20 +85,20 @@ GEM
85
85
  rspec-mocks (3.13.2)
86
86
  diff-lcs (>= 1.2.0, < 2.0)
87
87
  rspec-support (~> 3.13.0)
88
- rspec-support (3.13.1)
88
+ rspec-support (3.13.2)
89
89
  rspec_junit_formatter (0.6.0)
90
90
  rspec-core (>= 2, < 4, != 2.12.0)
91
- rubocop (1.68.0)
91
+ rubocop (1.69.1)
92
92
  json (~> 2.3)
93
93
  language_server-protocol (>= 3.17.0)
94
94
  parallel (~> 1.10)
95
95
  parser (>= 3.3.0.2)
96
96
  rainbow (>= 2.2.2, < 4.0)
97
- regexp_parser (>= 2.4, < 3.0)
98
- rubocop-ast (>= 1.32.2, < 2.0)
97
+ regexp_parser (>= 2.9.3, < 3.0)
98
+ rubocop-ast (>= 1.36.2, < 2.0)
99
99
  ruby-progressbar (~> 1.7)
100
- unicode-display_width (>= 2.4.0, < 3.0)
101
- rubocop-ast (1.34.1)
100
+ unicode-display_width (>= 2.4.0, < 4.0)
101
+ rubocop-ast (1.36.2)
102
102
  parser (>= 3.3.1.0)
103
103
  rubocop-capybara (2.21.0)
104
104
  rubocop (~> 1.41)
@@ -114,7 +114,7 @@ GEM
114
114
  rubocop-rspec_rails (2.29.1)
115
115
  rubocop (~> 1.61)
116
116
  ruby-progressbar (1.13.0)
117
- securerandom (0.3.2)
117
+ securerandom (0.4.0)
118
118
  simplecov (0.22.0)
119
119
  docile (~> 1.1)
120
120
  simplecov-html (~> 0.11)
@@ -123,8 +123,10 @@ GEM
123
123
  simplecov_json_formatter (0.1.4)
124
124
  tzinfo (2.0.6)
125
125
  concurrent-ruby (~> 1.0)
126
- unicode-display_width (2.6.0)
127
- uri (1.0.1)
126
+ unicode-display_width (3.1.2)
127
+ unicode-emoji (~> 4.0, >= 4.0.4)
128
+ unicode-emoji (4.0.4)
129
+ uri (1.0.2)
128
130
  webmock (3.24.0)
129
131
  addressable (>= 2.8.0)
130
132
  crack (>= 0.3.2)
@@ -80,6 +80,25 @@ module Dor
80
80
  Nokogiri::XML(resp).xpath('//object[@id]').map { |n| n[:id] }
81
81
  end
82
82
 
83
+ # Returns a list of druids from the workflow service that meet the criteria
84
+ # of the passed in error param
85
+ #
86
+ # @see `#objects_for_workstep`
87
+ #
88
+ # @param [String] error name of the error step
89
+ # @param [Hash] options
90
+ # @param options [String] :default_workflow workflow to query for if not using the qualified format
91
+ # @option options [Integer] :limit maximum number of druids to return (nil for no limit)
92
+ # @return [Array<String>] Array of druids
93
+ def objects_erroring_at_workstep(error, options = {})
94
+ uri_string = "workflow_queue?error=#{error}"
95
+ uri_string += "&limit=#{options[:limit].to_i}" if options[:limit]&.to_i&.positive?
96
+
97
+ resp = requestor.request uri_string
98
+
99
+ Nokogiri::XML(resp).xpath('//object[@id]').map { |n| n[:id] }
100
+ end
101
+
83
102
  private
84
103
 
85
104
  attr_reader :requestor
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '7.6.1'
6
+ VERSION = '7.7.0'
7
7
  end
8
8
  end
9
9
  end
@@ -46,8 +46,7 @@ module Dor
46
46
 
47
47
  delegate :lifecycle, :active_lifecycle, :milestones, to: :lifecycle_routes
48
48
 
49
- delegate :lane_ids, :objects_for_workstep,
50
- to: :queues
49
+ delegate :lane_ids, :objects_for_workstep, :objects_erroring_at_workstep, to: :queues
51
50
 
52
51
  def queues
53
52
  @queues ||= Queues.new(requestor: requestor)
@@ -391,6 +391,38 @@ RSpec.describe Dor::Workflow::Client do
391
391
  end
392
392
  end
393
393
 
394
+ describe '#objects_erroring_at_workstep' do
395
+ before do
396
+ @workflow = 'googleScannedBookWF'
397
+ @error = 'process-content'
398
+ end
399
+
400
+ let(:stubs) do
401
+ Faraday::Adapter::Test::Stubs.new do |stub|
402
+ stub.get("workflow_queue?error=#{@workflow}:#{@error}") do |_env|
403
+ [200, {}, '<objects count="1"><object id="druid:ab123de4567"/><object id="druid:ab123de9012"/></objects>']
404
+ end
405
+ end
406
+ end
407
+
408
+ context 'with a query using qualified workflow name for error' do
409
+ before do
410
+ @qualified_error = "#{@workflow}:#{@error}"
411
+ end
412
+
413
+ context 'with URI string creation' do
414
+ before do
415
+ @xml = %(<objects count="1"><object id="druid:ab123de4567"/></objects>)
416
+ end
417
+
418
+ it 'with lane ID' do
419
+ allow(mock_http_connection).to receive(:get).with("workflow_queue?error=#{@qualified_error}").and_return(double(Faraday::Response, body: @xml))
420
+ expect(client.objects_erroring_at_workstep(@qualified_error)).to eq(['druid:ab123de4567'])
421
+ end
422
+ end
423
+ end
424
+ end
425
+
394
426
  context 'when empty workflow queue' do
395
427
  before do
396
428
  @workflow = 'googleScannedBookWF'
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.6.1
4
+ version: 7.7.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-11-11 00:00:00.000000000 Z
12
+ date: 2024-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.5.11
164
+ rubygems_version: 3.5.22
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: Provides convenience methods to work with the DOR Workflow Service