Exception: Ibanity::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ Error

Returns a new instance of Error.



5
6
7
# File 'lib/ibanity/error.rb', line 5

def initialize(errors)
  @errors = errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/ibanity/error.rb', line 3

def errors
  @errors
end

Instance Method Details

#to_sObject



9
10
11
12
13
14
15
16
17
# File 'lib/ibanity/error.rb', line 9

def to_s
  @errors.map do |error|
    if error["attribute"]
      "* #{error["code"]}: '#{error["attribute"]}' #{error["message"]}"
    else
      "* #{error["code"]}: #{error["message"]}"
    end
  end.join("\n")
end