Sha256: 089aed3d427a3e1572fcf2e3b6dca56942b0d88f1a2db97443259ae39cd3c254

Contents?: true

Size: 1006 Bytes

Versions: 6

Compression:

Stored size: 1006 Bytes

Contents

require "rooler/engine"
require 'rooler/liquid_filters'
require 'liquid'
require 'ckeditor'
require 'simple_form'
require 'rubytree'

module Rooler
  BaseController ||= ActionController::Base
  
  def self.process_scheduled_rules
    Rule.ready_to_be_checked.each do |rule|
      begin
        rule.process
      rescue => error
        Rails.logger.error("RULE ERROR: rule id #{rule.id} - #{error}")
      end
    end
  end
  
  def self.clear_non_applicable_deliveries
    Rule.all.each do |rule|
      begin
        rule.clear_non_applicable_deliveries
      rescue => error
        Rails.logger.error("RULE ERROR: rule_id #{rule.id} - #{error}")
      end
    end
  end
  
  def self.deliver_pending_emails
    Delivery.undelivered.each do |delivery|
      begin
        delivery.update_column(:delivered_at, Time.now) if DeliveryMailer.send_mail(delivery).deliver
      rescue => error
        Rails.logger.error("DELIVERY ERROR: delivery id #{delivery.id} - #{error}")
      end
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rooler-0.0.11 lib/rooler.rb
rooler-0.0.10 lib/rooler.rb
rooler-0.0.9 lib/rooler.rb
rooler-0.0.8 lib/rooler.rb
rooler-0.0.7 lib/rooler.rb
rooler-0.0.6 lib/rooler.rb