Class: Stream::RaiseHttpException
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Stream::RaiseHttpException
- Defined in:
- lib/stream/client.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RaiseHttpException
constructor
A new instance of RaiseHttpException.
Constructor Details
#initialize(app) ⇒ RaiseHttpException
Returns a new instance of RaiseHttpException.
182 183 184 185 |
# File 'lib/stream/client.rb', line 182 def initialize(app) super app @parser = nil end |
Instance Method Details
#call(env) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/stream/client.rb', line 165 def call(env) @app.call(env).on_complete do |response| case response[:status].to_i when 200..203 return response when 401 raise StreamApiResponseException, (response, 'Bad feed') when 403 raise StreamApiResponseException, (response, 'Bad auth/headers') when 404 raise StreamApiResponseException, (response, 'url not found') when 204...600 raise StreamApiResponseException, (response, (response.body)) end end end |