dor-workflow-client 3.12.0 → 3.13.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 +0 -1
- data/lib/dor/missing_workflow_exception.rb +6 -0
- data/lib/dor/workflow/client/requestor.rb +10 -2
- data/lib/dor/workflow/client/version.rb +1 -1
- data/lib/dor/workflow_exception.rb +1 -1
- data/spec/workflow/client_spec.rb +9 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea39b8e90466517fda9d9c0c8a7d1e6bfe2fe09d38566e51db76031e2768eae0
|
4
|
+
data.tar.gz: d75001c1f99852c3cd0410ea5cb018abf713162c04fcc81cc43c58817bcae34a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e414f5936d21fed90a4690ada9cf3df8c6130734c043a9b0e4c178c8fbe17f5320547dc83c0982e17ee11fb660054b644f8d57cf873128ca91fd05aabe31dc7
|
7
|
+
data.tar.gz: cc096fad25055d2f31fb3344d9af42fddeeb36aa90a12795a620c6b6a14dbd1946fd3996902a6092ecb352bc49bd10f6ef51eab2fd585faf4e039796c6e8fdae
|
data/Gemfile
CHANGED
@@ -18,13 +18,21 @@ module Dor
|
|
18
18
|
# @param [String] payload body for (e.g. put) request
|
19
19
|
# @param [Hash] opts addtional headers options
|
20
20
|
# @return [Object] response from method
|
21
|
+
# @raise [Dor::WorkflowException,Dor::MissingWorkflowException] if there are Faraday exceptions
|
21
22
|
def request(uri_string, meth = 'get', payload = '', opts = {})
|
22
23
|
response = send_workflow_resource_request(uri_string, meth, payload, opts)
|
23
24
|
response.body
|
24
25
|
rescue Faraday::Error => e
|
26
|
+
# `status` is set to `nil` if:
|
27
|
+
# * `e` does not respond to `:response`
|
28
|
+
# * `e` responds to `:response` and:
|
29
|
+
# * `e.response` is `nil`
|
30
|
+
# * `e.response` is a hash missing the `:status` key
|
31
|
+
# else it is set to the value of `e.response[:status]`
|
32
|
+
status = e.try(:response)&.fetch(:status, nil)
|
25
33
|
msg = "Failed to retrieve resource: #{meth} #{base_url}/#{uri_string}"
|
26
|
-
msg += " (HTTP status #{
|
27
|
-
raise Dor::WorkflowException, msg
|
34
|
+
msg += " (HTTP status #{status})" unless status.nil?
|
35
|
+
raise (status == 404 ? Dor::MissingWorkflowException : Dor::WorkflowException), msg
|
28
36
|
end
|
29
37
|
|
30
38
|
private
|
@@ -329,9 +329,17 @@ RSpec.describe Dor::Workflow::Client do
|
|
329
329
|
end
|
330
330
|
end
|
331
331
|
|
332
|
-
context 'when
|
332
|
+
context 'when the status is not found' do
|
333
333
|
let(:status) { 404 }
|
334
334
|
|
335
|
+
it 'throws the missing workflow exception' do
|
336
|
+
expect { subject }.to raise_error Dor::MissingWorkflowException
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
context 'when it fails with status other than 404' do
|
341
|
+
let(:status) { 422 }
|
342
|
+
|
335
343
|
it 'throws an exception' do
|
336
344
|
expect { subject }.to raise_error Dor::WorkflowException
|
337
345
|
end
|
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: 3.
|
4
|
+
version: 3.13.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: 2019-12-
|
12
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- README.md
|
210
210
|
- Rakefile
|
211
211
|
- dor-workflow-client.gemspec
|
212
|
+
- lib/dor/missing_workflow_exception.rb
|
212
213
|
- lib/dor/workflow/client.rb
|
213
214
|
- lib/dor/workflow/client/connection_factory.rb
|
214
215
|
- lib/dor/workflow/client/lifecycle_routes.rb
|
@@ -251,7 +252,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
252
|
- !ruby/object:Gem::Version
|
252
253
|
version: '0'
|
253
254
|
requirements: []
|
254
|
-
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 2.7.8
|
255
257
|
signing_key:
|
256
258
|
specification_version: 4
|
257
259
|
summary: Provides convenience methods to work with the DOR Workflow Service
|