Class: Hugs::Errors::HTTP
- Inherits:
-
Object
- Object
- Hugs::Errors::HTTP
- Defined in:
- lib/hugs/errors.rb
Overview
504
Instance Method Summary collapse
-
#initialize(options) ⇒ HTTP
constructor
A new instance of HTTP.
- #on(response) ⇒ Object
Constructor Details
#initialize(options) ⇒ HTTP
Returns a new instance of HTTP.
43 44 45 46 47 |
# File 'lib/hugs/errors.rb', line 43 def initialize @raise_errors = [:raise_errors] initialize_errors end |
Instance Method Details
#on(response) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/hugs/errors.rb', line 49 def on response case response.code when @raise_errors && %r{^[45]{1}[0-9]{2}$} ; raise_for(response) end response end |