Exception: Mountapi::Error::InvalidParameter
- Inherits:
-
StandardError
- Object
- StandardError
- Mountapi::Error::InvalidParameter
- Defined in:
- lib/mountapi/error/invalid_parameter.rb
Overview
When an error occured if parameter casting or serialization The message should contain an array of validation errors
Instance Method Summary collapse
-
#initialize(errors) ⇒ InvalidParameter
constructor
A new instance of InvalidParameter.
- #to_json_api ⇒ Object
Constructor Details
#initialize(errors) ⇒ InvalidParameter
Returns a new instance of InvalidParameter.
6 7 8 9 |
# File 'lib/mountapi/error/invalid_parameter.rb', line 6 def initialize(errors) @errors = errors super(errors) end |
Instance Method Details
#to_json_api ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mountapi/error/invalid_parameter.rb', line 11 def to_json_api @errors.map do |error| { id: error[:schema], title: error[:message], status: 400, source: { pointer: error[:fragment], parameter: error[:failed_attribute] } } end end |