Exception: JSONAPI::Exceptions::InvalidFilterValue

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter, value) ⇒ InvalidFilterValue

Returns a new instance of InvalidFilterValue.


162
163
164
165
# File 'lib/jsonapi/exceptions.rb', line 162

def initialize(filter, value)
  @filter = filter
  @value = value
end

Instance Attribute Details

#filterObject

Returns the value of attribute filter


161
162
163
# File 'lib/jsonapi/exceptions.rb', line 161

def filter
  @filter
end

#valueObject

Returns the value of attribute value


161
162
163
# File 'lib/jsonapi/exceptions.rb', line 161

def value
  @value
end

Instance Method Details

#errorsObject


167
168
169
170
171
172
173
174
175
# File 'lib/jsonapi/exceptions.rb', line 167

def errors
  [JSONAPI::Error.new(code: JSONAPI::INVALID_FILTER_VALUE,
                      status: :bad_request,
                      title: I18n.translate('jsonapi-resources.exceptions.invalid_filter_value.title',
                                            default: 'Invalid filter value'),
                      detail: I18n.translate('jsonapi-resources.exceptions.invalid_filter_value.detail',
                                             default: "#{value} is not a valid value for #{filter}.",
                                             value: value, filter: filter))]
end