lib/timber/cli/api.rb in timber-2.1.0.rc3 vs lib/timber/cli/api.rb in timber-2.1.0.rc4

- old
+ new

@@ -62,11 +62,11 @@ APPLICATION_PATH = "/installer/application".freeze EVENT_PATH = "/installer/events".freeze HAS_LOGS_PATH = "/installer/has_logs".freeze USER_AGENT = "Timber Ruby/#{Timber::VERSION} (HTTP)".freeze - attr_reader :api_key + attr_accessor :api_key def initialize(api_key) @api_key = api_key @session_id = SecureRandom.uuid end @@ -101,11 +101,11 @@ case iteration when 0 event(:waiting_for_logs) when 20 - event(:excessively_waiting_for_logs) + event(:excessive_log_waiting) when 60 raise LogsNotReceivedError.new end sleep 0.5 @@ -140,10 +140,13 @@ req['Content-Type'] = "application/json" issue!(req) end def issue!(req) - req['Authorization'] = "Basic #{encoded_api_key}" + if api_key + req['Authorization'] = "Basic #{encoded_api_key}" + end + req['User-Agent'] = USER_AGENT req['X-Installer-Session-Id'] = @session_id res = http.start do |http| http.request(req) end \ No newline at end of file