Exception: PCO::API::Errors::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- PCO::API::Errors::BaseError
- Defined in:
- lib/pco/api/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ BaseError
constructor
A new instance of BaseError.
- #inspect ⇒ Object
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ BaseError
Returns a new instance of BaseError.
9 10 11 12 13 |
# File 'lib/pco/api/errors.rb', line 9 def initialize(response) @status = response.status @detail = response.body @headers = response.headers end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
7 8 9 |
# File 'lib/pco/api/errors.rb', line 7 def detail @detail end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/pco/api/errors.rb', line 7 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/pco/api/errors.rb', line 7 def status @status end |
Instance Method Details
#inspect ⇒ Object
24 25 26 |
# File 'lib/pco/api/errors.rb', line 24 def inspect "<#{self.class.name} status=#{status} message=#{.inspect} detail=#{detail.inspect}>" end |
#message ⇒ Object
19 20 21 22 |
# File 'lib/pco/api/errors.rb', line 19 def return detail.to_s unless detail.is_a?(Hash) detail['message'] || || detail.to_s end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/pco/api/errors.rb', line 15 def to_s end |