Class: FinAppsCore::Middleware::XConsumerId
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FinAppsCore::Middleware::XConsumerId
- Defined in:
- lib/finapps_core/middleware/request/x_consumer_id.rb
Overview
Adds a header to specify consumer to retrieve data for
Constant Summary collapse
- KEY =
'X-Consumer-ID'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, x_consumer_id) ⇒ XConsumerId
constructor
A new instance of XConsumerId.
Constructor Details
#initialize(app, x_consumer_id) ⇒ XConsumerId
Returns a new instance of XConsumerId.
9 10 11 12 |
# File 'lib/finapps_core/middleware/request/x_consumer_id.rb', line 9 def initialize(app, x_consumer_id) super(app) @x_consumer_id = x_consumer_id.to_s.strip end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 |
# File 'lib/finapps_core/middleware/request/x_consumer_id.rb', line 14 def call(env) env[:request_headers][KEY] ||= @x_consumer_id @app.call(env) end |