Class: Totangorb::Tracker

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

Constant Summary collapse

BASE_URL =
'http://sdr.totango.com/pixel.gif/?'

Instance Method Summary collapse

Constructor Details

#initialize(service_id = nil, options = {}) {|_self| ... } ⇒ Tracker

Returns a new instance of Tracker.

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (::Error)


13
14
15
16
17
18
19
20
# File 'lib/totangorb/tracker.rb', line 13

def initialize(service_id = nil, options = {})
  raise(::Error, 'You must provide your private API key.') unless service_id
  @service_id = service_id
  @debug      = options.fetch(:debug, false)
  @logger     = options.fetch(:logger) { NullLogger.new }

  yield(self) if block_given?
end

Instance Method Details

#track(params = nil) {|params| ... } ⇒ Object

Yields:

  • (params)


22
23
24
25
26
27
28
# File 'lib/totangorb/tracker.rb', line 22

def track(params = nil)
  params ||= OpenStruct.new

  yield(params) if block_given?

  perform_request(params.to_h)
end