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: 1f0e2fd9ebdb375566b00555a8b67f97a87e92ae535ee4af2de577a795ea65f8
4
- data.tar.gz: 1c743a08edb6aa5d3a1952fc8d1521ab955302b6217801c1428053018fc74ff5
3
+ metadata.gz: 456668a1280fa0e7dd4423a81dcc50d1273dadd0dba808928927941638c15ac7
4
+ data.tar.gz: 31f9cb181859491b26e0192abbdf559bc49326c2086f1267f8aab04e6b3a1279
5
5
  SHA512:
6
- metadata.gz: 1aaec24bb6b238865e8158e0d44bcade62e066b8495129b7ef4dd9d93446b88dc435e9a881216a8c045ae8383ccb0649b1f48aadc0319fae5068566b75a8e29f
7
- data.tar.gz: 1b5dddf8959cca07a06c271b7dfb4fee8247524e7f3eabc2dcfa8546a60abbd4f38c45969a0c246d9f6ba174d0054386709c284c5be044d67eb21a6c0b3bad46
6
+ metadata.gz: 2c06f5c320d447f4b5b7b53659a71c1836c19b6b7d456344fc6442a2d4c4c91ea6d2d9a176a1f3921a8732283d9390a7c78b24b03966ba0bbd6b58324fed575a
7
+ data.tar.gz: 52e84748ee08d4e663c5b2851133ab59aeb2229e04bab863733be7fd3d70a15238ff470d7569d7c8271208139196ddddd274124416a59811b2b971b77802fbf2
@@ -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
 
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '5.0.0'
6
+ VERSION = '5.1.0'
7
7
  end
8
8
  end
9
9
  end
@@ -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
- raise (response.status == 404 ? NotFoundResponse : UnexpectedResponse),
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.0.0
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-24 00:00:00.000000000 Z
12
+ date: 2020-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport