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.
63 64 65 |
# File 'lib/jsonapi/exceptions.rb', line 63 def initialize(media_type) @media_type = media_type end |
Instance Attribute Details
#media_type ⇒ Object
Returns the value of attribute media_type.
62 63 64 |
# File 'lib/jsonapi/exceptions.rb', line 62 def media_type @media_type end |
Instance Method Details
#errors ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/jsonapi/exceptions.rb', line 67 def errors [JSONAPI::Error.new(code: JSONAPI::UNSUPPORTED_MEDIA_TYPE, status: :unsupported_media_type, title: I18n.translate('jsonapi-resources.exceptions.unsupported_media_type.title', default: 'Unsupported media type'), detail: I18n.translate('jsonapi-resources.exceptions.unsupported_media_type.detail', default: "All requests that create or update must use the '#{JSONAPI::MEDIA_TYPE}' Content-Type. This request specified '#{media_type}'.", needed_media_type: JSONAPI::MEDIA_TYPE, media_type: media_type))] end |