Class: ActorSync::Adapters::Mixpanel::Group

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

Instance Method Summary collapse

Constructor Details

#initialize(group_key, group_id, tracker, data, action) ⇒ Group

Returns a new instance of Group.



42
43
44
45
46
47
48
# File 'lib/actor_sync/adapters/mixpanel.rb', line 42

def initialize(group_key, group_id, tracker, data, action)
  @group_key = group_key
  @group_id = group_id
  @tracker = tracker
  @data = data
  @action = action
end

Instance Method Details

#callObject



50
51
52
53
# File 'lib/actor_sync/adapters/mixpanel.rb', line 50

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

#createObject



55
56
57
# File 'lib/actor_sync/adapters/mixpanel.rb', line 55

def create
  @tracker.groups.set(@group_key, @group_id, @data)
end

#destroyObject



59
60
61
# File 'lib/actor_sync/adapters/mixpanel.rb', line 59

def destroy
  @tracker.groups.delete_group(@group_key, @group_id)
end