Exception: JSONAPI::Exceptions::TypeMismatch

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ TypeMismatch

Returns a new instance of TypeMismatch.



121
122
123
# File 'lib/jsonapi/exceptions.rb', line 121

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



120
121
122
# File 'lib/jsonapi/exceptions.rb', line 120

def type
  @type
end

Instance Method Details

#errorsObject



125
126
127
128
129
130
# File 'lib/jsonapi/exceptions.rb', line 125

def errors
  [JSONAPI::Error.new(code: JSONAPI::TYPE_MISMATCH,
                      status: :bad_request,
                      title: 'Type Mismatch',
                      detail: "#{type} is not a valid type for this operation.")]
end