Exception: DIDKit::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- DIDKit::APIError
- Defined in:
- lib/didkit/errors.rb
Overview
Raised when an HTTP request returns a response with an error status.
Instance Attribute Summary collapse
-
#response ⇒ Net::HTTPResponse
readonly
The returned HTTP response.
Instance Method Summary collapse
-
#body ⇒ String
HTTP response body.
-
#initialize(response) ⇒ APIError
constructor
A new instance of APIError.
-
#status ⇒ Integer
HTTP status code.
Constructor Details
#initialize(response) ⇒ APIError
Returns a new instance of APIError.
14 15 16 17 |
# File 'lib/didkit/errors.rb', line 14 def initialize(response) @response = response super("APIError: #{response}") end |
Instance Attribute Details
#response ⇒ Net::HTTPResponse (readonly)
Returns the returned HTTP response.
11 12 13 |
# File 'lib/didkit/errors.rb', line 11 def response @response end |
Instance Method Details
#body ⇒ String
Returns HTTP response body.
25 26 27 |
# File 'lib/didkit/errors.rb', line 25 def body response.body end |
#status ⇒ Integer
Returns HTTP status code.
20 21 22 |
# File 'lib/didkit/errors.rb', line 20 def status response.code.to_i end |