Class: Jackpot::Cron
- Inherits:
-
Object
- Object
- Jackpot::Cron
- Defined in:
- lib/jackpot/cron.rb
Instance Method Summary collapse
-
#initialize(customer_storage, logger) ⇒ Cron
constructor
A new instance of Cron.
- #run ⇒ Object
Constructor Details
#initialize(customer_storage, logger) ⇒ Cron
Returns a new instance of Cron.
6 7 8 9 |
# File 'lib/jackpot/cron.rb', line 6 def initialize(customer_storage, logger) @customer_storage = customer_storage @logger = logger end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jackpot/cron.rb', line 11 def run overdue_customers = @customer_storage.overdue overdue_customers.each do |c| begin c.pay_subscription rescue Jackpot::Error => e @logger.error "Something was wrong when trying to process #{c} payment. Exception was #{e}" end end end |