Exception: Paggi::PaggiError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body = nil) ⇒ PaggiError

Returns a new instance of PaggiError.



4
5
6
# File 'lib/paggi/error.rb', line 4

def initialize(body = nil)
  @errors = body.nil? || body['errors'].nil? ? [] : body['errors'].map{ |error| symbolize_keys(error) }
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

Instance Method Details

#to_sObject



8
9
10
# File 'lib/paggi/error.rb', line 8

def to_s
  @errors.map{ |e| e[:param].nil? ? e[:message] : "#{e[:param]}: #{e[:message]}" }.join(', ')
end