active_record_api-request 0.3.17 → 0.3.18
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: 4bf85446f65a2cdec067be322385b94966bdf4f6cb457fe7914a118e563b2a9e
|
4
|
+
data.tar.gz: 10b170ac1aeed7d5b95cb87fef0bba7e3975715413395cb2578d8222941f70aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b83ec91607f9c2e6d0df1319f0cb0aeb9e0d1e0d740655c8660e9ac57c77f29e62f887bb4e5ca4066600fae71191f904260d83812889ca12dd09492d7e408b1
|
7
|
+
data.tar.gz: 3ef8d895de630379c8e35afbc3a0d8bdeefd3318854ab97ff1cc524bef7270dec0661029829f375813be43393462daacfd34c7c91d24d6a5ebe0d438c5b54cc9
|
@@ -24,7 +24,7 @@ module ActiveRecordApi
|
|
24
24
|
builder.use :http_cache, http_cache_options
|
25
25
|
builder.use FaradayFollowNextLinks, 5
|
26
26
|
builder.use FaradayMiddleware::FollowRedirects, standards_compliant: true
|
27
|
-
builder.use FaradayAuthTokenRetry, credentials: credentials, host: host, token_path: token_path, debug: debug
|
27
|
+
builder.use FaradayAuthTokenRetry, credentials: credentials, host: host, token_path: token_path, debug: debug, timeout: timeout
|
28
28
|
builder.response :json, content_type: /\bjson$/
|
29
29
|
builder.response :raise_error
|
30
30
|
builder.response :logger if debug
|
@@ -6,14 +6,15 @@ module ActiveRecordApi
|
|
6
6
|
class FaradayAuthTokenRetry < Faraday::Middleware
|
7
7
|
AUTH_KEY = 'Authorization'.freeze
|
8
8
|
|
9
|
-
attr_reader :credentials, :host, :token_path, :debug
|
9
|
+
attr_reader :credentials, :host, :token_path, :debug, :timeout
|
10
10
|
|
11
|
-
def initialize(app, credentials: nil, host: nil, token_path: nil, debug: false)
|
11
|
+
def initialize(app, credentials: nil, host: nil, token_path: nil, debug: false, timeout: nil)
|
12
12
|
super(app)
|
13
13
|
@credentials = credentials
|
14
14
|
@host = host
|
15
15
|
@token_path = token_path
|
16
16
|
@debug = debug
|
17
|
+
@timeout = nil
|
17
18
|
end
|
18
19
|
|
19
20
|
def call(env)
|
@@ -42,7 +43,7 @@ module ActiveRecordApi
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def retrieve_token
|
45
|
-
token_cache.fetch_token Proc.new { TokenRetriever.new(credentials: credentials, host: host, token_path: token_path, debug: debug).fetch_token }
|
46
|
+
token_cache.fetch_token Proc.new { TokenRetriever.new(credentials: credentials, host: host, token_path: token_path, debug: debug, timeout: timeout).fetch_token }
|
46
47
|
end
|
47
48
|
|
48
49
|
def token_cache
|