module MandrillEvent

Constants

VERSION

Attributes

adapter[RW]
backend[RW]
namespace[RW]

Public Class Methods

configure() { |self| ... } click to toggle source
# File lib/mandrill_event.rb, line 11
def configure(&block)
  raise ArgumentError, 'must provide a block' unless block_given?
  block.arity.zero? ? instance_eval(&block) : yield(self)
end
instrument(params) click to toggle source
# File lib/mandrill_event.rb, line 22
def instrument(params)
  backend.instrument namespace.call(params['event']), params
end
process(params) click to toggle source
# File lib/mandrill_event.rb, line 16
def process(params)
  JSON.parse(params['mandrill_events'] || '[]').each do |event_params|
    instrument(event_params)
  end
end
subscribe(name, callable = Proc.new) click to toggle source
# File lib/mandrill_event.rb, line 26
def subscribe(name, callable = Proc.new)
  backend.subscribe namespace.to_regexp(name), adapter.call(callable)
end