Class: FacebookApp::Conversion

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/facebook_app/conversion.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_or_create(conversion_id, marketing_mode) ⇒ Object



40
41
42
43
44
# File 'app/models/facebook_app/conversion.rb', line 40

def self.find_or_create(conversion_id, marketing_mode)
  find(conversion_id)
rescue
  create(:marketing_mode => marketing_mode)
end

.track(conversion_id, conversion_event = nil, marketing_mode = nil) ⇒ Object



46
47
48
49
50
# File 'app/models/facebook_app/conversion.rb', line 46

def self.track(conversion_id, conversion_event=nil, marketing_mode=nil)
  conversion = find_or_create(conversion_id, marketing_mode)
  conversion.send(conversion_event) unless conversion_event.nil?
  return conversion
end

Instance Method Details

#recent?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/models/facebook_app/conversion.rb', line 52

def recent? 
  created_at < 6.hours.ago 
end