Exception: JSONAPI::Exceptions::NotAcceptableError
- 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 = {}) ⇒ NotAcceptableError
constructor
A new instance of NotAcceptableError.
Methods inherited from Error
Constructor Details
#initialize(media_type, error_object_overrides = {}) ⇒ NotAcceptableError
Returns a new instance of NotAcceptableError.
105 106 107 108 |
# File 'lib/jsonapi/exceptions.rb', line 105 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.
103 104 105 |
# File 'lib/jsonapi/exceptions.rb', line 103 def media_type @media_type end |
Instance Method Details
#errors ⇒ Object
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/jsonapi/exceptions.rb', line 110 def errors [create_error_object(code: JSONAPI::NOT_ACCEPTABLE, status: :not_acceptable, title: I18n.translate('jsonapi-resources.exceptions.not_acceptable.title', default: 'Not acceptable'), detail: I18n.translate('jsonapi-resources.exceptions.not_acceptable.detail', default: "All requests must use the '#{JSONAPI::MEDIA_TYPE}' Accept without media type parameters. This request specified '#{media_type}'.", needed_media_type: JSONAPI::MEDIA_TYPE, media_type: media_type))] end |