Module: Roguelytics::HasRoguelytics::LocalInstanceMethods

Defined in:
lib/roguelytics/has_roguelytics.rb

Instance Method Summary collapse

Instance Method Details

#roguelytics_createObject



43
44
45
# File 'lib/roguelytics/has_roguelytics.rb', line 43

def roguelytics_create
  self.roguelytics_get 'create', roguelytics_params
end

#roguelytics_deleteObject



51
52
53
# File 'lib/roguelytics/has_roguelytics.rb', line 51

def roguelytics_delete
  self.roguelytics_get 'delete', roguelytics_params
end

#roguelytics_get(event, params) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/roguelytics/has_roguelytics.rb', line 31

def roguelytics_get event, params
  if Rails.env.development?
    Roguelytics::ProcessJob.perform_now event, params rescue nil
  else
    Roguelytics::ProcessJob.perform_later event, params rescue nil
  end
end

#roguelytics_paramsObject



39
40
41
# File 'lib/roguelytics/has_roguelytics.rb', line 39

def roguelytics_params
  params = { model_name: self.class.to_s, id: self.id, created_at: "#{self.created_at.to_s}", name: (self.name rescue nil) }
end

#roguelytics_updateObject



47
48
49
# File 'lib/roguelytics/has_roguelytics.rb', line 47

def roguelytics_update
  self.roguelytics_get 'update', roguelytics_params
end