Exception: JSONAPI::Exceptions::FilterNotAllowed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter) ⇒ FilterNotAllowed


146
147
148
# File 'lib/jsonapi/exceptions.rb', line 146

def initialize(filter)
  @filter = filter
end

Instance Attribute Details

#filterObject

Returns the value of attribute filter


145
146
147
# File 'lib/jsonapi/exceptions.rb', line 145

def filter
  @filter
end

Instance Method Details

#errorsObject


150
151
152
153
154
155
156
157
# File 'lib/jsonapi/exceptions.rb', line 150

def errors
  [JSONAPI::Error.new(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