Class: Leadlight::ServiceMiddleware
- Inherits:
-
Object
- Object
- Leadlight::ServiceMiddleware
- Defined in:
- lib/leadlight/service_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ ServiceMiddleware
constructor
A new instance of ServiceMiddleware.
Constructor Details
#initialize(app, options = {}) ⇒ ServiceMiddleware
Returns a new instance of ServiceMiddleware.
6 7 8 9 |
# File 'lib/leadlight/service_middleware.rb', line 6 def initialize(app, ={}) @app = app @service = .fetch(:service) end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/leadlight/service_middleware.rb', line 11 def call(env) env[:leadlight_service] = @service env[:request_headers]['Accept'] = default_accept_types @app.call(env).on_complete do |env| env[:leadlight_representation] = represent(env) end end |