Sha256: c8f98f59dbaae768d7e27eab1a03b66fea492056d855d46682c03b5375de630a

Contents?: true

Size: 551 Bytes

Versions: 10

Compression:

Stored size: 551 Bytes

Contents

module FunWithJsonApi
  module Exceptions
    # Indicates a Resource or Collection item not authorized
    class UnauthorizedResource < FunWithJsonApi::Exception
      def initialize(message, payload = ExceptionPayload.new)
        payload = Array.wrap(payload).each do |unauthorized|
          unauthorized.code ||= 'unauthorized_resource'
          unauthorized.title ||=
            I18n.t('unauthorized_resource', scope: 'fun_with_json_api.exceptions')
          unauthorized.status ||= '403'
        end
        super
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fun_with_json_api-0.0.14 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.13 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.11.3 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.11.2 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.11.1 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.11 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.10.4 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.10.3 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.10.2 lib/fun_with_json_api/exceptions/unauthorized_resource.rb
fun_with_json_api-0.0.10.1 lib/fun_with_json_api/exceptions/unauthorized_resource.rb