module Rnotifier

Constants

VERSION

Public Class Methods

alert(name, params, tags = {}) click to toggle source
# File lib/rnotifier.rb, line 59
def alert(name, params, tags = {})
  if Rnotifier::Config.valid? && params.is_a?(Hash)
    Rnotifier::EventData.new(name, Rnotifier::EventData::ALERT, params, tags[:tags]).notify 
  end
end
clear_context() click to toggle source
# File lib/rnotifier.rb, line 45
def clear_context
  Thread.current[:rnotifier_context] = nil
end
config() { |Config| ... } click to toggle source
# File lib/rnotifier.rb, line 20
def config(&block)
  yield(Rnotifier::Config) if block_given?
  Rnotifier::Config.init
end
context(attrs = {}) click to toggle source
# File lib/rnotifier.rb, line 37
def context(attrs = {})
  if Thread.current[:rnotifier_context] 
    Thread.current[:rnotifier_context].merge!(attrs)
  else
    Thread.current[:rnotifier_context] = attrs
  end
end
event(name, params, tags = {}) click to toggle source
# File lib/rnotifier.rb, line 53
def event(name, params, tags = {})
  if Rnotifier::Config.valid? && params.is_a?(Hash)
    Rnotifier::EventData.new(name, Rnotifier::EventData::EVENT, params, tags[:tags]).notify 
  end
end
exception(exception, params = {}) click to toggle source
# File lib/rnotifier.rb, line 49
def exception(exception, params = {})
  Rnotifier::ExceptionData.new(exception, params, {:type => :rescue}).notify
end
load_config(file) click to toggle source
# File lib/rnotifier.rb, line 25
def load_config(file)
  config_yaml = YAML.load_file(file)

  self.config do |c|
    c.api_key = config_yaml['apikey'] 

    ['environments', 'api_host', 'ignore_exceptions', 'ignore_bots', 'capture_code'].each do |f|
      c.send("#{f}=", config_yaml[f]) if config_yaml[f]
    end
  end
end