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.
478 479 480 481 482 483 484 485 |
# File 'lib/jsonapi/exceptions.rb', line 478 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.
476 477 478 |
# File 'lib/jsonapi/exceptions.rb', line 476 def @error_messages end |
#error_metadata ⇒ Object (readonly)
Returns the value of attribute error_metadata.
476 477 478 |
# File 'lib/jsonapi/exceptions.rb', line 476 def @error_metadata end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
476 477 478 |
# File 'lib/jsonapi/exceptions.rb', line 476 def resource_class @resource_class end |
#resource_relationships ⇒ Object (readonly)
Returns the value of attribute resource_relationships.
476 477 478 |
# File 'lib/jsonapi/exceptions.rb', line 476 def resource_relationships @resource_relationships end |
Instance Method Details
#errors ⇒ Object
491 492 493 494 495 |
# File 'lib/jsonapi/exceptions.rb', line 491 def errors .flat_map do |attr_key, | .map { || json_api_error(attr_key, ) } end end |
#format_key(key) ⇒ Object
487 488 489 |
# File 'lib/jsonapi/exceptions.rb', line 487 def format_key(key) @key_formatter.format(key) end |