dor-services-client 5.0.0 → 5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 456668a1280fa0e7dd4423a81dcc50d1273dadd0dba808928927941638c15ac7
|
4
|
+
data.tar.gz: 31f9cb181859491b26e0192abbdf559bc49326c2086f1267f8aab04e6b3a1279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c06f5c320d447f4b5b7b53659a71c1836c19b6b7d456344fc6442a2d4c4c91ea6d2d9a176a1f3921a8732283d9390a7c78b24b03966ba0bbd6b58324fed575a
|
7
|
+
data.tar.gz: 52e84748ee08d4e663c5b2851133ab59aeb2229e04bab863733be7fd3d70a15238ff470d7569d7c8271208139196ddddd274124416a59811b2b971b77802fbf2
|
data/lib/dor/services/client.rb
CHANGED
@@ -31,6 +31,9 @@ module Dor
|
|
31
31
|
# this could be any 4xx or 5xx status
|
32
32
|
class UnexpectedResponse < Error; end
|
33
33
|
|
34
|
+
# Error that is raised when the remote server returns a 401 Unauthorized
|
35
|
+
class UnauthorizedResponse < UnexpectedResponse; end
|
36
|
+
|
34
37
|
# Error that is raised when the remote server returns some unparsable response
|
35
38
|
class MalformedResponse < Error; end
|
36
39
|
|
@@ -20,7 +20,15 @@ module Dor
|
|
20
20
|
attr_reader :connection, :api_version
|
21
21
|
|
22
22
|
def raise_exception_based_on_response!(response, object_identifier = nil)
|
23
|
-
|
23
|
+
exception_class = case response.status
|
24
|
+
when 404
|
25
|
+
NotFoundResponse
|
26
|
+
when 401
|
27
|
+
UnauthorizedResponse
|
28
|
+
else
|
29
|
+
UnexpectedResponse
|
30
|
+
end
|
31
|
+
raise exception_class,
|
24
32
|
ResponseErrorFormatter.format(response: response, object_identifier: object_identifier)
|
25
33
|
end
|
26
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|