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_relationships ⇒ Object
readonly
Returns the value of attribute resource_relationships.
Instance Method Summary collapse
- #errors ⇒ Object
- #format_key(key) ⇒ Object
-
#initialize(resource) ⇒ ValidationErrors
constructor
A new instance of ValidationErrors.
Constructor Details
#initialize(resource) ⇒ ValidationErrors
Returns a new instance of ValidationErrors.
380 381 382 383 384 385 |
# File 'lib/jsonapi/exceptions.rb', line 380 def initialize(resource) @error_messages = resource. @error_metadata = resource. @resource_relationships = resource.class._relationships.keys @key_formatter = JSONAPI.configuration.key_formatter end |
Instance Attribute Details
#error_messages ⇒ Object (readonly)
Returns the value of attribute error_messages.
378 379 380 |
# File 'lib/jsonapi/exceptions.rb', line 378 def @error_messages end |
#error_metadata ⇒ Object (readonly)
Returns the value of attribute error_metadata.
378 379 380 |
# File 'lib/jsonapi/exceptions.rb', line 378 def @error_metadata end |
#resource_relationships ⇒ Object (readonly)
Returns the value of attribute resource_relationships.
378 379 380 |
# File 'lib/jsonapi/exceptions.rb', line 378 def resource_relationships @resource_relationships end |
Instance Method Details
#errors ⇒ Object
391 392 393 394 395 |
# File 'lib/jsonapi/exceptions.rb', line 391 def errors .flat_map do |attr_key, | .map { || json_api_error(attr_key, ) } end end |
#format_key(key) ⇒ Object
387 388 389 |
# File 'lib/jsonapi/exceptions.rb', line 387 def format_key(key) @key_formatter.format(key) end |