Exception: JSONAPI::Exceptions::ParameterMissing

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ ParameterMissing


309
310
311
# File 'lib/jsonapi/exceptions.rb', line 309

def initialize(param)
  @param = param
end

Instance Attribute Details

#paramObject

Returns the value of attribute param


308
309
310
# File 'lib/jsonapi/exceptions.rb', line 308

def param
  @param
end

Instance Method Details

#errorsObject


313
314
315
316
317
318
319
320
# File 'lib/jsonapi/exceptions.rb', line 313

def errors
  [JSONAPI::Error.new(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