Exception: JSONAPI::Exceptions::ValidationErrors
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#error_messages ⇒ Object
readonly
Returns the value of attribute error_messages.
-
#error_metadata ⇒ Object
readonly
Returns the value of attribute error_metadata.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
-
#resource_relationships ⇒ Object
readonly
Returns the value of attribute resource_relationships.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
- #format_key(key) ⇒ Object
-
#initialize(resource, error_object_overrides = {}) ⇒ ValidationErrors
constructor
A new instance of ValidationErrors.
Methods inherited from Error
Constructor Details
#initialize(resource, error_object_overrides = {}) ⇒ ValidationErrors
Returns a new instance of ValidationErrors.
476 477 478 479 480 481 482 483 |
# File 'lib/jsonapi/exceptions.rb', line 476 def initialize(resource, error_object_overrides = {}) @error_messages = resource. @error_metadata = resource. @resource_class = resource.class @resource_relationships = resource.class._relationships.keys @key_formatter = JSONAPI.configuration.key_formatter super(error_object_overrides) end |
Instance Attribute Details
#error_messages ⇒ Object (readonly)
Returns the value of attribute error_messages.
474 475 476 |
# File 'lib/jsonapi/exceptions.rb', line 474 def @error_messages end |
#error_metadata ⇒ Object (readonly)
Returns the value of attribute error_metadata.
474 475 476 |
# File 'lib/jsonapi/exceptions.rb', line 474 def @error_metadata end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
474 475 476 |
# File 'lib/jsonapi/exceptions.rb', line 474 def resource_class @resource_class end |
#resource_relationships ⇒ Object (readonly)
Returns the value of attribute resource_relationships.
474 475 476 |
# File 'lib/jsonapi/exceptions.rb', line 474 def resource_relationships @resource_relationships end |
Instance Method Details
#errors ⇒ Object
489 490 491 492 493 |
# File 'lib/jsonapi/exceptions.rb', line 489 def errors .flat_map do |attr_key, | .map { || json_api_error(attr_key, ) } end end |
#format_key(key) ⇒ Object
485 486 487 |
# File 'lib/jsonapi/exceptions.rb', line 485 def format_key(key) @key_formatter.format(key) end |