Class: Garage::Strategy::AuthServer::AccessTokenFetcher
- Inherits:
-
Object
- Object
- Garage::Strategy::AuthServer::AccessTokenFetcher
- Defined in:
- lib/garage/strategy/auth_server.rb
Overview
Returns an AccessToken from request object or returns nil if failed.
Constant Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(request) ⇒ AccessTokenFetcher
constructor
A new instance of AccessTokenFetcher.
Constructor Details
#initialize(request) ⇒ AccessTokenFetcher
Returns a new instance of AccessTokenFetcher.
53 54 55 |
# File 'lib/garage/strategy/auth_server.rb', line 53 def initialize(request) @request = request end |
Class Method Details
.fetch(*args) ⇒ Object
49 50 51 |
# File 'lib/garage/strategy/auth_server.rb', line 49 def self.fetch(*args) new(*args).fetch end |
Instance Method Details
#fetch ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/garage/strategy/auth_server.rb', line 57 def fetch if has_any_valid_credentials? if has_cacheable_credentials? fetch_with_cache else fetch_without_cache end else nil end rescue Timeout::Error raise AuthBackendTimeout.new(OPEN_TIMEOUT, read_timeout) end |