Class: Neoway::Auth::AuthenticatedConnection
- Inherits:
-
Connection
- Object
- Flash::Integration::Connection
- Connection
- Neoway::Auth::AuthenticatedConnection
- Defined in:
- lib/neoway/auth/authenticated_connection.rb
Constant Summary collapse
- COOKIE_CACHE_KEY =
"NEOWAY_AUTHENTICATION_COOKIE_CACHE_KEY"
Instance Method Summary collapse
- #default_headers ⇒ Object
-
#initialize(authentication: Neoway::Auth::Authentication.new, cache: default_cache) ⇒ AuthenticatedConnection
constructor
A new instance of AuthenticatedConnection.
Constructor Details
#initialize(authentication: Neoway::Auth::Authentication.new, cache: default_cache) ⇒ AuthenticatedConnection
Returns a new instance of AuthenticatedConnection.
8 9 10 11 12 13 14 |
# File 'lib/neoway/auth/authenticated_connection.rb', line 8 def initialize(authentication: Neoway::Auth::Authentication.new, cache: default_cache) super(request_class: request_class, base_url: base_url) @authentication = authentication @cache = cache @expiration_time = Neoway::Auth::TOKEN_EXPIRATION.seconds end |
Instance Method Details
#default_headers ⇒ Object
16 17 18 |
# File 'lib/neoway/auth/authenticated_connection.rb', line 16 def default_headers super.merge(Authorization: (@cache ? cached_token : auth_token)) end |