Exception: JSONAPI::Exceptions::InvalidSortParam

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, sort_param) ⇒ InvalidSortParam

Returns a new instance of InvalidSortParam.



135
136
137
138
# File 'lib/jsonapi/exceptions.rb', line 135

def initialize(resource, sort_param)
  @resource = resource
  @sort_param = sort_param
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



134
135
136
# File 'lib/jsonapi/exceptions.rb', line 134

def resource
  @resource
end

#sort_paramObject

Returns the value of attribute sort_param.



134
135
136
# File 'lib/jsonapi/exceptions.rb', line 134

def sort_param
  @sort_param
end

Instance Method Details

#errorsObject



140
141
142
143
144
145
# File 'lib/jsonapi/exceptions.rb', line 140

def errors
  [JSONAPI::Error.new(code: JSONAPI::INVALID_SORT_PARAM,
                      status: :bad_request,
                      title: 'Invalid sort param',
                      detail: "#{sort_param} is not a valid sort param for #{resource}")]
end