Exception: Simple::HTTP::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Simple::HTTP::Error
- Defined in:
- lib/simple/http/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(method, request, response) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
Constructor Details
#initialize(method, request, response) ⇒ Error
Returns a new instance of Error.
12 13 14 |
# File 'lib/simple/http/errors.rb', line 12 def initialize(method, request, response) @method, @request, @response = method, request, response end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
10 11 12 |
# File 'lib/simple/http/errors.rb', line 10 def method @method end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
10 11 12 |
# File 'lib/simple/http/errors.rb', line 10 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/simple/http/errors.rb', line 10 def response @response end |
Instance Method Details
#code ⇒ Object
16 17 18 |
# File 'lib/simple/http/errors.rb', line 16 def code response.code.to_i end |
#message ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/simple/http/errors.rb', line 20 def = "#{method} #{response.uri} ##{response.code} #{response.}" if response.is_a?(Net::HTTPRedirection) += " To #{response["Location"]}" end end |