Exception: JSONAPI::Exceptions::FilterNotAllowed

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

Instance Attribute Summary collapse

Attributes inherited from Error

#error_object_overrides

Instance Method Summary collapse

Methods inherited from Error

#create_error_object

Constructor Details

#initialize(filter, error_object_overrides = {}) ⇒ FilterNotAllowed

Returns a new instance of FilterNotAllowed.



204
205
206
207
# File 'lib/jsonapi/exceptions.rb', line 204

def initialize(filter, error_object_overrides = {})
  @filter = filter
  super(error_object_overrides)
end

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



202
203
204
# File 'lib/jsonapi/exceptions.rb', line 202

def filter
  @filter
end

Instance Method Details

#errorsObject



209
210
211
212
213
214
215
216
# File 'lib/jsonapi/exceptions.rb', line 209

def errors
  [create_error_object(code: JSONAPI::FILTER_NOT_ALLOWED,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.filter_not_allowed.title',
                                             default: 'Filter not allowed'),
                       detail: I18n.translate('jsonapi-resources.exceptions.filter_not_allowed.detail',
                                              default: "#{filter} is not allowed.", filter: filter))]
end