Exception: JSONAPI::Exceptions::ParametersNotAllowed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ ParametersNotAllowed


290
291
292
# File 'lib/jsonapi/exceptions.rb', line 290

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params


289
290
291
# File 'lib/jsonapi/exceptions.rb', line 289

def params
  @params
end

Instance Method Details

#errorsObject


294
295
296
297
298
299
300
301
302
303
304
# File 'lib/jsonapi/exceptions.rb', line 294

def errors
  params.collect do |param|
    JSONAPI::Error.new(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