class DogEventer::DogEventer

Public Class Methods

new(api_key, application_key=nil) click to toggle source
# File lib/dogeventer.rb, line 7
def initialize(api_key, application_key=nil)
  @dog = Dogapi::Client.new(api_key, application_key)
  @events = []
end

Public Instance Methods

generate(start_time, &block) click to toggle source
# File lib/dogeventer.rb, line 12
def generate(start_time, &block)
  @start_time = start_time
  instance_eval &block

  @events.each do |event|
    puts event.inspect
    @dog.emit_event(Dogapi::Event.new('', event), :host => event[:host])
  end
end
host(host_name, &block) click to toggle source
# File lib/dogeventer.rb, line 22
def host(host_name, &block)
  h = Host.new(@start_time, host_name)
  @events += (h.instance_eval &block)
end
url(url, &block) click to toggle source
# File lib/dogeventer.rb, line 27
def url(url, &block)
  u = Url.new(@start_time, url)
  @events += (u.instance_eval &block)
end