Exception: HOALife::HTTPError
- Defined in:
- lib/hoalife/error.rb
Overview
HTTP Errors
Direct Known Subclasses
BadRequestError, ForbiddenError, NotFoundError, RateLimitError, UnauthorizedError
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, headers, details) ⇒ HTTPError
constructor
A new instance of HTTPError.
Constructor Details
#initialize(status, headers, details) ⇒ HTTPError
Returns a new instance of HTTPError.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hoalife/error.rb', line 10 def initialize(status, headers, details) @status = status @headers = headers begin @details = JSON.parse(details) rescue JSON::ParserError, TypeError @details = details end super(status) end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
8 9 10 |
# File 'lib/hoalife/error.rb', line 8 def details @details end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
8 9 10 |
# File 'lib/hoalife/error.rb', line 8 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/hoalife/error.rb', line 8 def status @status end |