Exception: JSONAPI::Exceptions::PageParametersNotAllowed

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(params, error_object_overrides = {}) ⇒ PageParametersNotAllowed

Returns a new instance of PageParametersNotAllowed.



557
558
559
560
# File 'lib/jsonapi/exceptions.rb', line 557

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

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



555
556
557
# File 'lib/jsonapi/exceptions.rb', line 555

def params
  @params
end

Instance Method Details

#errorsObject



562
563
564
565
566
567
568
569
570
571
572
# File 'lib/jsonapi/exceptions.rb', line 562

def errors
  params.collect do |param|
    create_error_object(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