Exception: JSONAPI::Exceptions::UnsupportedMediaTypeError
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#media_type ⇒ Object
Returns the value of attribute media_type.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(media_type) ⇒ UnsupportedMediaTypeError
constructor
A new instance of UnsupportedMediaTypeError.
Constructor Details
#initialize(media_type) ⇒ UnsupportedMediaTypeError
Returns a new instance of UnsupportedMediaTypeError.
50 51 52 |
# File 'lib/jsonapi/exceptions.rb', line 50 def initialize(media_type) @media_type = media_type end |
Instance Attribute Details
#media_type ⇒ Object
Returns the value of attribute media_type.
49 50 51 |
# File 'lib/jsonapi/exceptions.rb', line 49 def media_type @media_type end |
Instance Method Details
#errors ⇒ Object
54 55 56 57 58 59 |
# File 'lib/jsonapi/exceptions.rb', line 54 def errors [JSONAPI::Error.new(code: JSONAPI::UNSUPPORTED_MEDIA_TYPE, status: :unsupported_media_type, title: 'Unsupported media type', detail: "All requests that create or update resources must use the '#{JSONAPI::MEDIA_TYPE}' Content-Type. This request specified '#{media_type}.'")] end |