Class: EME::BT

Inherits:
APIConsumer
  • Object
show all
Defined in:
lib/eme/bt.rb

Class Method Summary collapse

Class Method Details

.track(data = {}, conn = connection, opts = {}, reload = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/eme/bt.rb', line 5

def self.track(data = {}, conn = connection, opts = {}, reload = false)
  return nil if data[:master_account_id].nil? || data[:action].nil? || data[:label].nil?
  d = { :uid => data[:master_account_id], :act => data[:action], :label => data[:label] }
  d[:game]  = data[:game] || settings[:game]
  d[:res]   = data[:resource] || settings[:resource]
  d[:md]    = data[:metadata] if data[:metadata]
  d[:ip]    = data[:ip] if data[:ip]
  
  opts[:method] = :post
  #opts[:body] = d.to_json
  
  opts[:body] = URI.encode_www_form(d)
  opts[:headers] = {"Content-Type" => "application/x-www-form-urlencoded"}
  return do_request("/cast", conn, opts)
end