Class: TravelTime::Middleware::Authentication
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- TravelTime::Middleware::Authentication
- Defined in:
- lib/travel_time/middleware/authentication.rb
Overview
The Authentication middleware is responsible for setting the auth headers on each request. These are automatically taken from the ‘TravelTime.config`.
Constant Summary collapse
- APP_ID_HEADER =
'X-Application-Id'
- API_KEY_HEADER =
'X-Api-Key'
- USER_AGENT =
'User-Agent'
Instance Method Summary collapse
Instance Method Details
#on_request(env) ⇒ Object
14 15 16 17 18 |
# File 'lib/travel_time/middleware/authentication.rb', line 14 def on_request(env) env.request_headers[APP_ID_HEADER] = TravelTime.config.application_id env.request_headers[API_KEY_HEADER] = TravelTime.config.api_key env.request_headers[USER_AGENT] = "Travel Time Ruby SDK #{TravelTime::VERSION}" end |