Module: Saucy::Account::ClassMethods
- Defined in:
- lib/saucy/account.rb
Instance Method Summary collapse
- #deliver_expiring_trial_notifications ⇒ Object
- #deliver_new_unactivated_notifications ⇒ Object
- #new_unactivated ⇒ Object
- #trial_expiring ⇒ Object
Instance Method Details
#deliver_expiring_trial_notifications ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/saucy/account.rb', line 82 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
74 75 76 77 78 79 80 |
# File 'lib/saucy/account.rb', line 74 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
97 98 99 100 |
# File 'lib/saucy/account.rb', line 97 def new_unactivated where(["accounts.created_at <= ?", 7.days.ago]). where(:asked_to_activate => false, :activated => false) end |
#trial_expiring ⇒ Object
90 91 92 93 94 95 |
# File 'lib/saucy/account.rb', line 90 def trial_expiring includes(:plan). where(:plans => { :trial => true }). where(:notified_of_expiration => false). where(["accounts.created_at <= ?", 23.days.ago]) end |