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.



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

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

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



553
554
555
# File 'lib/jsonapi/exceptions.rb', line 553

def params
  @params
end

Instance Method Details

#errorsObject



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

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