Sha256: 9d07b9c07ea5a08a8dc7b5d8fd9f869fe2097f8debcb7f35d9d27622924fac39

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

namespace :freemium do
  desc "Run the billing task"
  task run_billing: :environment do
    # charge all billable subscriptions
    @transactions = Subscription.find_billable.collect{ |b| b.charge! }

    # actually expire any subscriptions whose time has come
    Subscription.find_expired.each(&:expire!)

    # send the activity report
    if Freemium.configuration.admin_report_recipients && !@transactions.empty?
      Freemium.configuration.mailer.admin_report(@transactions).deliver
    end

    @transactions
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
freemium-ajb-0.0.4 lib/tasks/freemium.rake