Exception: Shipay::ValidationError
- Inherits:
-
ShipayError
- Object
- StandardError
- ShipayError
- Shipay::ValidationError
- Defined in:
- lib/shipay/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.
39 40 41 42 43 44 45 46 |
# File 'lib/shipay/errors.rb', line 39 def initialize(response) @response = response @errors = response['message']&.map do || 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.
37 38 39 |
# File 'lib/shipay/errors.rb', line 37 def errors @errors end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
37 38 39 |
# File 'lib/shipay/errors.rb', line 37 def response @response end |
Instance Method Details
#to_h ⇒ Object
48 49 50 |
# File 'lib/shipay/errors.rb', line 48 def to_h @errors.map(&:to_h) end |