class ElasticNotifier::Notifier

Public Class Methods

new(options) click to toggle source
# File lib/elastic_notifier.rb, line 15
def initialize(options)
  @repo ||= Elasticsearch::Persistence::Repository.new do
    client Elasticsearch::Client.new url: options[:url]
    index  options.fetch(:index, :elastic_notifier)
    type   options.fetch(:type, :signals)
  end
  @options = options
end

Public Instance Methods

call(exception, params = {})
Alias for: notify_error
notify_error(exception, params = {}) click to toggle source
# File lib/elastic_notifier.rb, line 24
def notify_error(exception, params = {})
  overrides = {
    program_name: @options[:program_name]
  }.merge(params)
  error = Error.new(exception, overrides).to_hash
  @repo.save(error)
end
Also aliased as: call