Exception: JSONAPI::Exceptions::ParameterMissing

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

Returns a new instance of ParameterMissing.



388
389
390
391
# File 'lib/jsonapi/exceptions.rb', line 388

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

Instance Attribute Details

#paramObject

Returns the value of attribute param.



386
387
388
# File 'lib/jsonapi/exceptions.rb', line 386

def param
  @param
end

Instance Method Details

#errorsObject



393
394
395
396
397
398
399
400
# File 'lib/jsonapi/exceptions.rb', line 393

def errors
  [create_error_object(code: JSONAPI::PARAM_MISSING,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.parameter_missing.title',
                                             default: 'Missing Parameter'),
                       detail: I18n.translate('jsonapi-resources.exceptions.parameter_missing.detail',
                                              default: "The required parameter, #{param}, is missing.", param: param))]
end