Exception: DIDKit::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/didkit/errors.rb

Overview

Raised when an HTTP request returns a response with an error status.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ APIError

Returns a new instance of APIError.

Parameters:

  • the returned HTTP response



14
15
16
17
# File 'lib/didkit/errors.rb', line 14

def initialize(response)
  @response = response
  super("APIError: #{response}")
end

Instance Attribute Details

#responseNet::HTTPResponse (readonly)

Returns the returned HTTP response.

Returns:

  • the returned HTTP response



11
12
13
# File 'lib/didkit/errors.rb', line 11

def response
  @response
end

Instance Method Details

#bodyString

Returns HTTP response body.

Returns:

  • HTTP response body



25
26
27
# File 'lib/didkit/errors.rb', line 25

def body
  response.body
end

#statusInteger

Returns HTTP status code.

Returns:

  • HTTP status code



20
21
22
# File 'lib/didkit/errors.rb', line 20

def status
  response.code.to_i
end