module Moist::Models::CampaignSubscriber

Public Class Methods

included(klass) click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 4
def self.included(klass)
  #    klass.extend ClassMethods
end

Public Instance Methods

current_step() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 8
def current_step
  most_recent_moist_mailing
end
mail!() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 32
def mail!
  next_mailing.deliver!
end
next_mailing() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 16
def next_mailing
  return nil unless next_step

   moist_mailings.find_by(mailer_class: next_step.mailer_class, mailer_action: next_step.mailer_action)
end
next_step() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 12
def next_step
  next_moist_mailing || raise(::Moist::CampaignComplete)
end
next_step?() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 22
def next_step?
  next_moist_mailing.present?
end
ready_for_next_mailing?() click to toggle source
# File lib/moist/models/campaign_subscriber.rb, line 26
def ready_for_next_mailing?
  return false unless next_mailing

  next_mailing.send_at < Time.current
end