Module: Saucy::Account::ClassMethods
- Defined in:
- lib/saucy/account.rb
Instance Method Summary collapse
- #deliver_completed_trial_notifications ⇒ Object
- #deliver_expiring_trial_notifications ⇒ Object
- #deliver_new_unactivated_notifications ⇒ Object
- #new_unactivated ⇒ Object
- #trial ⇒ Object
- #trial_completed ⇒ Object
- #trial_expiring ⇒ Object
Instance Method Details
#deliver_completed_trial_notifications ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/saucy/account.rb', line 101 def deliver_completed_trial_notifications trial_completed.each do |account| BillingMailer.completed_trial(account).deliver account.notified_of_completed_trial = true account.save! end end |
#deliver_expiring_trial_notifications ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/saucy/account.rb', line 93 def deliver_expiring_trial_notifications trial_expiring.each do |account| BillingMailer.expiring_trial(account).deliver account.notified_of_expiration = true account.save! end end |
#deliver_new_unactivated_notifications ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/saucy/account.rb', line 85 def deliver_new_unactivated_notifications new_unactivated.each do |account| BillingMailer.new_unactivated(account).deliver account.asked_to_activate = true account.save! end end |
#new_unactivated ⇒ Object
115 116 117 118 |
# File 'lib/saucy/account.rb', line 115 def new_unactivated where(["accounts.created_at <= ?", 7.days.ago]). where(:asked_to_activate => false, :activated => false) end |
#trial ⇒ Object
126 127 128 129 |
# File 'lib/saucy/account.rb', line 126 def trial includes(:plan). where(:plans => { :trial => true }) end |
#trial_completed ⇒ Object
120 121 122 123 124 |
# File 'lib/saucy/account.rb', line 120 def trial_completed trial. where(:notified_of_completed_trial => false). where(["accounts.trial_expires_at <= ?", Time.now]) end |
#trial_expiring ⇒ Object
109 110 111 112 113 |
# File 'lib/saucy/account.rb', line 109 def trial_expiring trial. where(:notified_of_expiration => false). where(["accounts.trial_expires_at <= ?", 7.days.from_now]) end |