Class: Stream::RaiseHttpException

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/stream/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RaiseHttpException

Returns a new instance of RaiseHttpException.



216
217
218
219
# File 'lib/stream/client.rb', line 216

def initialize(app)
  super app
  @parser = nil
end

Instance Method Details

#call(env) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
# File 'lib/stream/client.rb', line 204

def call(env)
  @app.call(env).on_complete do |response|
    status_code = response[:status].to_i
    case status_code
    when 200..203
      return response
    else
      parse_error(response, status_code: status_code)
    end
  end
end