Class: Rollday::Middleware

Inherits:
Faraday::Middleware
  • Object
show all
Includes:
RollbarHelper
Defined in:
lib/rollday/middleware.rb

Instance Method Summary collapse

Methods included from RollbarHelper

#rollbar_level, #rollbar_message, #rollbar_scope

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



10
11
12
13
14
# File 'lib/rollday/middleware.rb', line 10

def initialize(app, **)
  super(app)

  @app = app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/rollday/middleware.rb', line 16

def call(env)
  result = @app.(env)
  if ship_to_rollbar?(result.status)
    send_rollbar(result)
  end

  result
end