Class: MetricsAdapter::Adapters::Mixpanel

Inherits:
Object
  • Object
show all
Defined in:
lib/metrics_adapter/adapters/mixpanel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Mixpanel

Returns a new instance of Mixpanel.



6
7
8
9
# File 'lib/metrics_adapter/adapters/mixpanel.rb', line 6

def initialize(options)
  @tracker = ::Mixpanel::Tracker.new(options.fetch(:secret))
  @logger = ::MetricsAdapter.logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/metrics_adapter/adapters/mixpanel.rb', line 4

def logger
  @logger
end

#trackerObject (readonly)

Returns the value of attribute tracker.



4
5
6
# File 'lib/metrics_adapter/adapters/mixpanel.rb', line 4

def tracker
  @tracker
end

Instance Method Details

#publish(data) ⇒ Object



11
12
13
14
15
# File 'lib/metrics_adapter/adapters/mixpanel.rb', line 11

def publish(data)
  id = data.delete(:id)
  name = data.delete(:name)
  tracker.track(id, name, data)
end