Class: IndexTank::ClientResponseMiddleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- IndexTank::ClientResponseMiddleware
- Defined in:
- lib/indextank/client.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ ClientResponseMiddleware
constructor
A new instance of ClientResponseMiddleware.
- #on_complete(env) ⇒ Object
Constructor Details
#initialize(app) ⇒ ClientResponseMiddleware
Returns a new instance of ClientResponseMiddleware.
53 54 55 56 |
# File 'lib/indextank/client.rb', line 53 def initialize(app) super @parser = nil end |
Instance Method Details
#on_complete(env) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/indextank/client.rb', line 40 def on_complete(env) case env[:status] when 200 nil # this is the expected return code when 204 nil # this is the expected return code for empty responses when 401 raise InvalidApiKey else raise UnexpectedHTTPException, env[:body] end end |