Sha256: d6f6a7bc2abc1de534a280ec2724927cd0517bbbaba1fd8f340e9e51cac89c71

Contents?: true

Size: 366 Bytes

Versions: 6

Compression:

Stored size: 366 Bytes

Contents

module Tictail
  class ResponseParser < Faraday::Response::Middleware
    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
    class HTTPUnauthorized < Exception
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tictail-api-0.1.3 lib/tictail/faraday_middleware/response_parser.rb
tictail-api-0.1.2 lib/tictail/faraday_middleware/response_parser.rb
tictail-api-0.1.1 lib/tictail/faraday_middleware/response_parser.rb
tictail-api-0.0.6 lib/tictail/faraday_middleware/response_parser.rb
tictail-api-0.0.5 lib/tictail/faraday_middleware/response_parser.rb
tictail-api-0.0.4 lib/tictail/faraday_middleware/response_parser.rb