Exception: JSONAPI::Exceptions::InvalidSortFormat
- 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.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource, sort_criteria) ⇒ InvalidSortFormat
constructor
A new instance of InvalidSortFormat.
Constructor Details
#initialize(resource, sort_criteria) ⇒ InvalidSortFormat
Returns a new instance of InvalidSortFormat.
193 194 195 196 |
# File 'lib/jsonapi/exceptions.rb', line 193 def initialize(resource, sort_criteria) @resource = resource @sort_criteria = sort_criteria end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
192 193 194 |
# File 'lib/jsonapi/exceptions.rb', line 192 def resource @resource end |
#sort_criteria ⇒ Object
Returns the value of attribute sort_criteria.
192 193 194 |
# File 'lib/jsonapi/exceptions.rb', line 192 def sort_criteria @sort_criteria end |
Instance Method Details
#errors ⇒ Object
198 199 200 201 202 203 |
# File 'lib/jsonapi/exceptions.rb', line 198 def errors [JSONAPI::Error.new(code: JSONAPI::INVALID_SORT_FORMAT, status: :bad_request, title: 'Invalid sort format', detail: "#{sort_criteria} must start with a direction (+ or -)")] end |