Class: AmadeusDiscover::Authenticator
- Inherits:
-
Object
- Object
- AmadeusDiscover::Authenticator
- Defined in:
- lib/amadeus_discover/authenticator.rb,
lib/amadeus_discover/authenticator/token.rb,
lib/amadeus_discover/authenticator/response.rb,
lib/amadeus_discover/authenticator/credentials.rb
Overview
Authenticator to be used with Faraday’s Authentication Middleware
Authentication Middleware and this are automatically injected into your connection stack so you don’t need to configure them.
Constant Summary collapse
- ENDPOINT =
'/auth/realms/amadeus-discover/protocol/openid-connect/token'
Instance Method Summary collapse
- #bearer_token ⇒ Object
-
#initialize(connection, credentials = {}) ⇒ Authenticator
constructor
A new instance of Authenticator.
Constructor Details
#initialize(connection, credentials = {}) ⇒ Authenticator
Returns a new instance of Authenticator.
15 16 17 18 |
# File 'lib/amadeus_discover/authenticator.rb', line 15 def initialize(connection, credentials = {}) @connection = reconfigure(connection) @credentials = Credentials.new(credentials) end |
Instance Method Details
#bearer_token ⇒ Object
20 21 22 23 |
# File 'lib/amadeus_discover/authenticator.rb', line 20 def bearer_token @token = nil unless token.valid? token.value end |