Class: Squirtgun::Gun

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

Overview

TODO: decide if this is a shitty name because its all Squirtgun::Squirtgun..

Instance Method Summary collapse

Instance Method Details

#report(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/squirtgun.rb', line 25

def report(options={})
  return if options[:context].nil? or options[:value].nil?


  # TODO: add message format testing?  Guzzler currenlty expects [context]:[value]..

  options[:project_id] ||= Squirtgun::Config.project_id

  sock = UDPSocket.new
  sock.send({:stat => options, :hmac => encode_packet(options[:context] + options[:value], Squirtgun::Config.secret_key)}.to_json, 0, Squirtgun::Config.listener, Squirtgun::Config.listener_port)
  sock.close
end