Exception: JSONAPI::Exceptions::ParameterNotAllowed

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

Returns a new instance of ParameterNotAllowed.



393
394
395
396
# File 'lib/jsonapi/exceptions.rb', line 393

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

Instance Attribute Details

#paramObject

Returns the value of attribute param.



391
392
393
# File 'lib/jsonapi/exceptions.rb', line 391

def param
  @param
end

Instance Method Details

#errorsObject



398
399
400
401
402
403
404
405
# File 'lib/jsonapi/exceptions.rb', line 398

def errors
  [create_error_object(code: JSONAPI::PARAM_NOT_ALLOWED,
                      status: :bad_request,
                      title: I18n.translate('jsonapi-resources.exceptions.parameter_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