class JSONAPI::Exceptions::TypeMismatch

Attributes

type[RW]

Public Class Methods

new(type, error_object_overrides = {}) click to toggle source
Calls superclass method JSONAPI::Exceptions::Error::new
# File lib/jsonapi/exceptions.rb, line 295
def initialize(type, error_object_overrides = {})
  @type = type
  super(error_object_overrides)
end

Public Instance Methods

errors() click to toggle source
# File lib/jsonapi/exceptions.rb, line 300
def errors
  [create_error_object(code: JSONAPI::TYPE_MISMATCH,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.type_mismatch.title',
                                             default: 'Type Mismatch'),
                       detail: I18n.translate('jsonapi-resources.exceptions.type_mismatch.detail',
                                              default: "#{type} is not a valid type for this operation.", type: type))]
end