Module: Hyperfocal::Transmitter

Defined in:
lib/hyperfocal/transmitter.rb

Class Method Summary collapse

Class Method Details

.send(type, params) ⇒ Object



5
6
7
8
# File 'lib/hyperfocal/transmitter.rb', line 5

def send(type, params)
  url = URI(url_for(type))
  Net::HTTP.post_form(url, params)
end

.url_for(type) ⇒ Object



10
11
12
13
14
15
# File 'lib/hyperfocal/transmitter.rb', line 10

def url_for(type)
  raise 'Unknown Tracking Type' unless %w[ event metric user ].include?(type)

  host = Hyperfocal.host
  return "#{host}/#{type}"
end