Exception: JSONAPI::Exceptions::UnsupportedMediaTypeError
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#media_type ⇒ Object
Returns the value of attribute media_type.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(media_type, error_object_overrides = {}) ⇒ UnsupportedMediaTypeError
constructor
A new instance of UnsupportedMediaTypeError.
Methods inherited from Error
Constructor Details
#initialize(media_type, error_object_overrides = {}) ⇒ UnsupportedMediaTypeError
Returns a new instance of UnsupportedMediaTypeError.
85 86 87 88 |
# File 'lib/jsonapi/exceptions.rb', line 85 def initialize(media_type, error_object_overrides = {}) @media_type = media_type super(error_object_overrides) end |
Instance Attribute Details
#media_type ⇒ Object
Returns the value of attribute media_type.
83 84 85 |
# File 'lib/jsonapi/exceptions.rb', line 83 def media_type @media_type end |
Instance Method Details
#errors ⇒ Object
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/jsonapi/exceptions.rb', line 90 def errors [create_error_object(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 |