Class: ActorSync::Adapters::Mixpanel::User

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

Instance Method Summary collapse

Constructor Details

#initialize(distinct_id, tracker, data, action) ⇒ User

Returns a new instance of User.



20
21
22
23
24
25
# File 'lib/actor_sync/adapters/mixpanel.rb', line 20

def initialize(distinct_id, tracker, data, action)
  @distinct_id = distinct_id
  @tracker = tracker
  @data = data
  @action = action
end

Instance Method Details

#callObject



27
28
29
30
# File 'lib/actor_sync/adapters/mixpanel.rb', line 27

def call
  create if [:create, :update].include? @action
  destroy if @action == :destroy
end

#createObject



32
33
34
# File 'lib/actor_sync/adapters/mixpanel.rb', line 32

def create
  @tracker.people.set(@distinct_id, @data)
end

#destroyObject



36
37
38
# File 'lib/actor_sync/adapters/mixpanel.rb', line 36

def destroy
  @tracker.people.delete_user(@distinct_id)
end