dor-services-client 1.6.0 → 1.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: 4d1dee5577322be09cabbcbb773ac112d5ce931fd1607e77d030e6a6675aae8b
4
- data.tar.gz: c7f6ce0549cd4710484d4b25538acb8f2a7924254d693cca98e5700c809bec5b
3
+ metadata.gz: d21a10048e6c6a968aab94efe1343d0ccd8b516aa7400e38dbf7db600cdda10c
4
+ data.tar.gz: e3eb26fe950f1bf8b8c4c34a2ee8b24e082bd4a8aa0938a5c856a48090f5d498
5
5
  SHA512:
6
- metadata.gz: 8039ee3ee1c35d6ed5eacbf97872abe8fc01663df69e9864aad178bcac730ec6e4f4d5dd8a04d74aa79afe6fa35e9ea83cb74d0a7430c2a49dd02ecb9c2e84fe
7
- data.tar.gz: 6509e01c5a243ad19da854ffbdf8e84ea75fcf6cffd81c9bf2f7b7173bd7da4a6d71e64c0a968eba5797079549d524be08ca23d7b4856aecf95b2856e6d9eb29
6
+ metadata.gz: 0b2580ebf1b1b536a9934248a8d55cc0d8f956f9a438befcf48042a4ca26e309a167f4f4174439e1b4866e228482a922cc9add40b99aacc7a96a3fc817a9633d
7
+ data.tar.gz: 5ac1721da5515fd5a42be65b2bb3e59a9c03bae2a30fd52d1b9065e143a7874d616272a190b1dd6eb5ac4563fee1f3d4ec534f758ff78390a4d3bcaa383a4b8b
@@ -9,6 +9,7 @@ require 'dor/services/client/versioned_service'
9
9
  require 'dor/services/client/object'
10
10
  require 'dor/services/client/objects'
11
11
  require 'dor/services/client/workflows'
12
+ require 'dor/services/client/error_faraday_middleware'
12
13
 
13
14
  module Dor
14
15
  module Services
@@ -25,6 +26,8 @@ module Dor
25
26
  # Error that is raised when the remote server returns some unparsable response
26
27
  class MalformedResponse < Error; end
27
28
 
29
+ class ConnectionFailed < Error; end
30
+
28
31
  DEFAULT_VERSION = 'v1'
29
32
 
30
33
  include Singleton
@@ -78,6 +81,8 @@ module Dor
78
81
 
79
82
  def connection
80
83
  @connection ||= Faraday.new(url) do |conn|
84
+ conn.use ErrorFaradayMiddleware
85
+
81
86
  # @note when username & password are nil, this line is required else
82
87
  # the Faraday instance will be passed an empty block, which
83
88
  # causes the adapter not to be set. Thus, everything breaks.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ module Services
5
+ class Client
6
+ # This wraps any faraday connection errors with dor-service-client errors
7
+ class ErrorFaradayMiddleware < Faraday::Response::Middleware
8
+ def call(env)
9
+ @app.call(env)
10
+ rescue Faraday::ConnectionFailed
11
+ raise ConnectionFailed, 'unable to reach dor-services-app'
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '1.6.0'
6
+ VERSION = '1.7.0'
7
7
  end
8
8
  end
9
9
  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: 1.6.0
4
+ version: 1.7.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: 2019-03-13 00:00:00.000000000 Z
12
+ date: 2019-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -178,6 +178,7 @@ files:
178
178
  - bin/setup
179
179
  - dor-services-client.gemspec
180
180
  - lib/dor/services/client.rb
181
+ - lib/dor/services/client/error_faraday_middleware.rb
181
182
  - lib/dor/services/client/files.rb
182
183
  - lib/dor/services/client/object.rb
183
184
  - lib/dor/services/client/objects.rb