Exception: Rested::Error
- Inherits:
-
Exception
- Object
- Exception
- Rested::Error
- Defined in:
- lib/rested/error.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) http_response
Returns the value of attribute http_response.
-
- (Object) message
Returns the value of attribute message.
-
- (Object) reason
Returns the value of attribute reason.
-
- (Object) status
Returns the value of attribute status.
-
- (Object) validations
Returns the value of attribute validations.
Instance Method Summary (collapse)
-
- (Error) initialize(res)
constructor
A new instance of Error.
- - (Object) to_s
Constructor Details
- (Error) initialize(res)
A new instance of Error
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rested/error.rb', line 8 def initialize(res) hash = Rested::Base.decode_response(res) if hash.include? "error" then self. = hash["error"] end self.validations = Validations.new(hash['validations']) self.status = res.status self.reason = res.reason self.http_response = res end |
Instance Attribute Details
- (Object) http_response
Returns the value of attribute http_response
6 7 8 |
# File 'lib/rested/error.rb', line 6 def http_response @http_response end |
- (Object) message
Returns the value of attribute message
6 7 8 |
# File 'lib/rested/error.rb', line 6 def @message end |
- (Object) reason
Returns the value of attribute reason
6 7 8 |
# File 'lib/rested/error.rb', line 6 def reason @reason end |
- (Object) status
Returns the value of attribute status
6 7 8 |
# File 'lib/rested/error.rb', line 6 def status @status end |
- (Object) validations
Returns the value of attribute validations
6 7 8 |
# File 'lib/rested/error.rb', line 6 def validations @validations end |
Instance Method Details
- (Object) to_s
21 22 23 |
# File 'lib/rested/error.rb', line 21 def to_s "#{self.status} #{self.reason}" + (self..nil? ? "" : ": #{self.}") end |