Exception: GoCardless::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/gocardless-pro/error.rb

Overview

A class to represent an API Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Error

intialize a new error  @param error the error from the API



8
9
10
# File 'lib/gocardless-pro/error.rb', line 8

def initialize(error)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



4
5
6
# File 'lib/gocardless-pro/error.rb', line 4

def error
  @error
end

Instance Method Details

#codeObject

access the code from the response



28
29
30
# File 'lib/gocardless-pro/error.rb', line 28

def code
  @error['code']
end

#documentation_urlObject

access the documentation_url from the response



13
14
15
# File 'lib/gocardless-pro/error.rb', line 13

def documentation_url
  @error['documentation_url']
end

#errorsObject

access the errors from the response



38
39
40
# File 'lib/gocardless-pro/error.rb', line 38

def errors
  @error['errors']
end

#messageObject

access the message from the response



18
19
20
# File 'lib/gocardless-pro/error.rb', line 18

def message
  @error['message']
end

#request_idObject

access the request_id from the response



33
34
35
# File 'lib/gocardless-pro/error.rb', line 33

def request_id
  @error['request_id']
end

#typeObject

access the type from the response



23
24
25
# File 'lib/gocardless-pro/error.rb', line 23

def type
  @error['type']
end