Exception: JSONAPI::Exceptions::ParametersNotAllowed

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 = {}) ⇒ ParametersNotAllowed

Returns a new instance of ParametersNotAllowed.



370
371
372
373
# File 'lib/jsonapi/exceptions.rb', line 370

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

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



368
369
370
# File 'lib/jsonapi/exceptions.rb', line 368

def params
  @params
end

Instance Method Details

#errorsObject



375
376
377
378
379
380
381
382
383
384
385
# File 'lib/jsonapi/exceptions.rb', line 375

def errors
  params.collect do |param|
    create_error_object(code: JSONAPI::PARAM_NOT_ALLOWED,
                        status: :bad_request,
                        title: I18n.translate('jsonapi-resources.exceptions.parameters_not_allowed.title',
                                              default: 'Param not allowed'),
                        detail: I18n.translate('jsonapi-resources.exceptions.parameters_not_allowed.detail',
                                               default: "#{param} is not allowed.", param: param))

  end
end