class Erratum::Errors::Forbidden

Constants

NON_SPECIFIC_RESOURCE_ACTIONS

Attributes

action[W]
resource_id[RW]
resource_name[RW]

Public Instance Methods

action() click to toggle source
# File lib/erratum/errors/authorization/forbidden.rb, line 47
def action
  @action || 'access'
end
detail() click to toggle source
# File lib/erratum/errors/authorization/forbidden.rb, line 26
  def detail
    detail_quantity = if NON_SPECIFIC_RESOURCE_ACTIONS.include? action.to_s
                        "#{action} a #{resource_name}"
                      else
                        "#{action} the #{resource_name} with ID #{resource_id}"
                      end

    <<~HEREDOC.chomp.tr("\n", ' ')
      You do not have access to #{detail_quantity}. Providing a different set of
      credentials may potentially allow you access to this resource.
    HEREDOC
  end
http_status() click to toggle source
# File lib/erratum/errors/authorization/forbidden.rb, line 18
def http_status
  403
end
source() click to toggle source
# File lib/erratum/errors/authorization/forbidden.rb, line 39
def source
  @source ||= {
    'resource_name' => resource_name,
    'resource_id'   => resource_id,
    'action'        => @action,
  }
end
title() click to toggle source
# File lib/erratum/errors/authorization/forbidden.rb, line 22
def title
  'Forbidden'
end