Exception: PagarMe::ValidationError
- Inherits:
-
PagarMeError
- Object
- StandardError
- PagarMeError
- PagarMe::ValidationError
- Defined in:
- lib/pagarme/errors.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #to_h ⇒ Object
Constructor Details
#initialize(response) ⇒ ValidationError
Returns a new instance of ValidationError.
37 38 39 40 41 42 43 44 |
# File 'lib/pagarme/errors.rb', line 37 def initialize(response) @response = response @errors = response['errors'].map do |error| params = error.values_at('message', 'parameter_name', 'type', 'url') ParamError.new(*params) end super @errors.map(&:message).join(', ') end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
35 36 37 |
# File 'lib/pagarme/errors.rb', line 35 def errors @errors end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
35 36 37 |
# File 'lib/pagarme/errors.rb', line 35 def response @response end |
Instance Method Details
#to_h ⇒ Object
46 47 48 |
# File 'lib/pagarme/errors.rb', line 46 def to_h @errors.map(&:to_h) end |