Exception: JSONAPI::Exceptions::PageParametersNotAllowed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ PageParametersNotAllowed


447
448
449
# File 'lib/jsonapi/exceptions.rb', line 447

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params


446
447
448
# File 'lib/jsonapi/exceptions.rb', line 446

def params
  @params
end

Instance Method Details

#errorsObject


451
452
453
454
455
456
457
458
459
460
461
# File 'lib/jsonapi/exceptions.rb', line 451

def errors
  params.collect do |param|
    JSONAPI::Error.new(code: JSONAPI::PARAM_NOT_ALLOWED,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.page_parameters_not_allowed.title',
                                             default: 'Page parameter not allowed'),
                       detail: I18n.translate('jsonapi-resources.exceptions.page_parameters_not_allowed.detail',
                                              default: "#{param} is not an allowed page parameter.",
                                              param: param))
  end
end