Exception: FunWithJsonApi::Exceptions::InvalidDocumentType
- Inherits:
-
FunWithJsonApi::Exception
- Object
- StandardError
- FunWithJsonApi::Exception
- FunWithJsonApi::Exceptions::InvalidDocumentType
- Defined in:
- lib/fun_with_json_api/exceptions/invalid_document_type.rb
Overview
A server MUST return 409 Conflict when processing a POST request in which the resource object’s type is not among the type(s) that constitute the collection represented by the endpoint.
Constant Summary collapse
- EXCEPTION_CODE =
'invalid_document_type'.freeze
Instance Attribute Summary
Attributes inherited from FunWithJsonApi::Exception
Instance Method Summary collapse
-
#initialize(message, payload = ExceptionPayload.new) ⇒ InvalidDocumentType
constructor
A new instance of InvalidDocumentType.
Methods inherited from FunWithJsonApi::Exception
Constructor Details
#initialize(message, payload = ExceptionPayload.new) ⇒ InvalidDocumentType
Returns a new instance of InvalidDocumentType.
9 10 11 12 13 14 15 16 17 |
# File 'lib/fun_with_json_api/exceptions/invalid_document_type.rb', line 9 def initialize(, payload = ExceptionPayload.new) payload = Array.wrap(payload).each do |invalid| invalid.code ||= EXCEPTION_CODE invalid.title ||= I18n.t(EXCEPTION_CODE, scope: 'fun_with_json_api.exceptions') invalid.status ||= '409' invalid.pointer ||= '/data/type' end super end |