class Appsignal::AuthCheck

@api private
@return [Appsignal::Config] config to use in the authentication request.
@!attribute [r] config
auth_check.perform # => “401”
# Invalid push_api_key
auth_check.perform # => “200”
# Valid push_api_key
auth_check = Appsignal::AuthCheck.new(config)
config = Appsignal::Config.new(Dir.pwd, “production”)
@example
the AppSignal Push API.
Class used to perform a Push API validation / authentication check against

def initialize(config, logger = nil)

def initialize(config, logger = nil)
  @config = config
  if logger # rubocop:disable Style/GuardClause
    warn "Deprecated: `logger` argument will be removed in the next " \
      "major version."
  end
end

def perform

Raises:
  • (StandardError) - see {Appsignal::Transmitter#transmit}.

Returns:
  • (String) - response status code.
def perform
  Appsignal::Transmitter.new(ACTION, config).transmit({}).code
end

def perform_with_result

Returns:
  • (Array) - response tuple.
def perform_with_result
  status = perform
  result =
    case status
    when "200"
      "AppSignal has confirmed authorization!"
    when "401"
      "API key not valid with AppSignal..."
    else
      "Could not confirm authorization: " \
        "#{status.nil? ? "nil" : status}"
    end
  [status, result]
rescue => e
  result = "Something went wrong while trying to "\
           "authenticate with AppSignal: #{e}"
  [nil, result]
end