Class: Tictail::ResponseParser

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/tictail/faraday_middleware/response_parser.rb

Defined Under Namespace

Classes: HTTPUnauthorized

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/tictail/faraday_middleware/response_parser.rb', line 3

def call(env)
  # "env" contains the request
  @app.call(env).on_complete do
    if env[:status] == 401 || env[:status] == 403
      raise HTTPUnauthorized.new 'invalid tictail credentials'
    end
  end
end