Exception: FunWithJsonApi::Exceptions::UnauthorizedAttribute

Inherits:
FunWithJsonApi::Exception show all
Defined in:
lib/fun_with_json_api/exceptions/unauthorized_attribute.rb

Overview

Indicates a supplied attribute value is known but unable to be changed by this endpoint

Instance Attribute Summary

Attributes inherited from FunWithJsonApi::Exception

#payload

Instance Method Summary collapse

Methods inherited from FunWithJsonApi::Exception

#http_status

Constructor Details

#initialize(message, payload = ExceptionPayload.new) ⇒ UnauthorizedAttribute

Returns a new instance of UnauthorizedAttribute.



5
6
7
8
9
10
11
12
13
14
# File 'lib/fun_with_json_api/exceptions/unauthorized_attribute.rb', line 5

def initialize(message, payload = ExceptionPayload.new)
  payload = Array.wrap(payload).each do |unknown|
    unknown.code ||= 'unauthorized_attribute'
    unknown.title ||= I18n.t(
      :unauthorized_attribute, scope: 'fun_with_json_api.exceptions'
    )
    unknown.status ||= '403'
  end
  super
end