Exception: JSONAPI::Exceptions::InvalidSortCriteria
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#sort_criteria ⇒ Object
Returns the value of attribute sort_criteria.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource, sort_criteria, error_object_overrides = {}) ⇒ InvalidSortCriteria
constructor
A new instance of InvalidSortCriteria.
Methods inherited from Error
Constructor Details
#initialize(resource, sort_criteria, error_object_overrides = {}) ⇒ InvalidSortCriteria
Returns a new instance of InvalidSortCriteria.
373 374 375 376 377 |
# File 'lib/jsonapi/exceptions.rb', line 373 def initialize(resource, sort_criteria, error_object_overrides = {}) @resource = resource @sort_criteria = sort_criteria super(error_object_overrides) end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
371 372 373 |
# File 'lib/jsonapi/exceptions.rb', line 371 def resource @resource end |
#sort_criteria ⇒ Object
Returns the value of attribute sort_criteria.
371 372 373 |
# File 'lib/jsonapi/exceptions.rb', line 371 def sort_criteria @sort_criteria end |
Instance Method Details
#errors ⇒ Object
379 380 381 382 383 384 385 386 387 |
# File 'lib/jsonapi/exceptions.rb', line 379 def errors [create_error_object(code: JSONAPI::INVALID_SORT_CRITERIA, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.invalid_sort_criteria.title', default: 'Invalid sort criteria'), detail: I18n.translate('jsonapi-resources.exceptions.invalid_sort_criteria.detail', default: "#{sort_criteria} is not a valid sort criteria for #{resource}", sort_criteria: sort_criteria, resource: resource))] end |