Class: ReferThis

Inherits:
Referral
  • Object
show all
Defined in:
lib/referthis.rb

Class Method Summary collapse

Methods inherited from Referral

clicked_through_rate, construct, generate_referral, resolve_token

Class Method Details

.setupObject



9
10
11
12
# File 'lib/referthis.rb', line 9

def self.setup
  system('cp -r ' + File.dirname(File.absolute_path(__FILE__)) + '/db/migrate/* ' + "'" + Rails.root.to_s.split('app/').first + "/db/migrate/'")
  system('rake db:migrate')
end

.url(endpoints, user_current_id, url, referrer_name, optional = {:app_name=>Rails.application.class.to_s.split('::').first}) ⇒ Object



13
14
15
16
17
# File 'lib/referthis.rb', line 13

def self.url(endpoints, user_current_id, url, referrer_name, optional = {:app_name=>Rails.application.class.to_s.split('::').first})
  optional[:body].nil? ? optional[:body] = referrer_name + ' has referred you to ' + optional[:app_name] + '! You might be interested in checking out the following: ' + url + '/' : optional[:body]
  optional[:app_name].nil? ? optional[:app_name] = Rails.application.class.to_s.split('::').first : optional[:app_name]
  self.generate_referral(endpoints, user_current_id, url, referrer_name, optional)
end