lib/appsignal/auth_check.rb in appsignal-0.6.7 vs lib/appsignal/auth_check.rb in appsignal-0.7.0.alpha.1

- old
+ new

@@ -1,32 +1,18 @@ module Appsignal class AuthCheck ACTION = 'auth'.freeze - attr_reader :environment, :logger - attr_accessor :transmitter + attr_reader :config, :logger - def initialize(*args) - @environment = args.shift - options = args.empty? ? {} : args.last - @config = options[:config] - @logger = options[:logger] + def initialize(config, logger) + @config = config + @logger = logger end - def uri - transmitter.uri - end - - def config - @config ||= Appsignal::Config.new(Rails.root, environment, logger).load - end - def perform - self.transmitter = Appsignal::Transmitter.new( - config[:endpoint], ACTION, config[:api_key] - ) - transmitter.transmit({}) + Appsignal::Transmitter.new(ACTION, config).transmit({}) end def perform_with_result begin status = perform @@ -35,15 +21,15 @@ result = 'AppSignal has confirmed authorization!' when '401' result = 'API key not valid with AppSignal...' else result = 'Could not confirm authorization: '\ - "#{status.nil? ? 'nil' : status}" + "#{status.nil? ? 'nil' : status}" end [status, result] rescue Exception => e result = 'Something went wrong while trying to '\ - "authenticate with AppSignal: #{e}" + "authenticate with AppSignal: #{e}" [nil, result] end end end end