Module: Hyperfocal::Transmitter
- Defined in:
- lib/hyperfocal/transmitter.rb
Class Method Summary collapse
Class Method Details
.send(type, params) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/hyperfocal/transmitter.rb', line 7 def send(type, params) if send_event url = URI(url_for(type)) params.merge!(environment: Hyperfocal.configuration.env) Typhoeus.post(url, body: params) else Hyperfocal.logger.info "Logging #{type} params: #{params}" end end |
.send_event ⇒ Object
24 25 26 27 |
# File 'lib/hyperfocal/transmitter.rb', line 24 def send_event return true if Hyperfocal.configuration.env.nil? Hyperfocal.configuration.environments.include?(Hyperfocal.configuration.env) end |
.url_for(type) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/hyperfocal/transmitter.rb', line 17 def url_for(type) raise 'Unknown Tracking Type' unless %w[ event metric ].include?(type) host = Hyperfocal.host return "#{host}/#{type}" end |