Class: InkoopErrorTracker::Tracker

Inherits:
Object
  • Object
show all
Defined in:
lib/inkoop_error_tracker.rb

Overview

Your code goes here…

Constant Summary collapse

@@api_key =
nil

Class Method Summary collapse

Class Method Details

.api_key=(api_key) ⇒ Object



10
11
12
# File 'lib/inkoop_error_tracker.rb', line 10

def self.api_key=(api_key)
  @@api_key = api_key
end

.track(error) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/inkoop_error_tracker.rb', line 14

def self.track error
  if @@api_key
    uri = URI('http://error.inkoop.in/errors')
    message = "#{error.message} - #{error.backtrace[0]}"
    description = error.backtrace.join('\n')
    res = Net::HTTP.post_form(uri, 'message' => message, 'project_api' => @@api_key, 'description' => description)
  end
end