Exception: JSONAPI::Exceptions::KeyNotIncludedInURL

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ KeyNotIncludedInURL

Returns a new instance of KeyNotIncludedInURL.


336
337
338
# File 'lib/jsonapi/exceptions.rb', line 336

def initialize(key)
  @key = key
end

Instance Attribute Details

#keyObject

Returns the value of attribute key


335
336
337
# File 'lib/jsonapi/exceptions.rb', line 335

def key
  @key
end

Instance Method Details

#errorsObject


340
341
342
343
344
345
346
347
348
# File 'lib/jsonapi/exceptions.rb', line 340

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