Exception: BridgeBankin::API::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bridge_bankin/api/error.rb

Overview

Error is the base error from which all other more specific BridgeBankin errors derive.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, response_body = {}) ⇒ Error

Initializes Error

Parameters:

  • code (String)

    the HTTP code returned by the API

  • response_body (Hash) (defaults to: {})

    the parsed API response

Options Hash (response_body):

  • :type (String)

    the machine readable error message

  • :message (String)

    the human readable error message

  • :documentation_url (String)

    the optional link to documentation



18
19
20
21
22
23
24
25
# File 'lib/bridge_bankin/api/error.rb', line 18

def initialize(code, response_body = {})
  @payload = response_body
  @code = code
  @type = payload[:type]
  @documentation_url = payload[:documentation_url]

  super(payload[:message])
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



27
28
29
# File 'lib/bridge_bankin/api/error.rb', line 27

def code
  @code
end

#documentation_urlObject (readonly)

Returns the value of attribute documentation_url.



27
28
29
# File 'lib/bridge_bankin/api/error.rb', line 27

def documentation_url
  @documentation_url
end

#payloadObject (readonly)

Returns the value of attribute payload.



27
28
29
# File 'lib/bridge_bankin/api/error.rb', line 27

def payload
  @payload
end

#typeObject (readonly)

Returns the value of attribute type.



27
28
29
# File 'lib/bridge_bankin/api/error.rb', line 27

def type
  @type
end