Exception: JSONAPI::Exceptions::KeyNotIncludedInURL

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

Returns a new instance of KeyNotIncludedInURL.



429
430
431
432
# File 'lib/jsonapi/exceptions.rb', line 429

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

Instance Attribute Details

#keyObject

Returns the value of attribute key.



427
428
429
# File 'lib/jsonapi/exceptions.rb', line 427

def key
  @key
end

Instance Method Details

#errorsObject



434
435
436
437
438
439
440
441
442
# File 'lib/jsonapi/exceptions.rb', line 434

def errors
  [create_error_object(code: JSONAPI::KEY_NOT_INCLUDED_IN_URL,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.key_not_included_in_url.title',
                                             default: 'Key is not included in URL'),
                       detail: I18n.translate('jsonapi-resources.exceptions.key_not_included_in_url.detail',
                                              default: "The URL does not support the key #{key}",
                                              key: key))]
end