class EffectivePollsMailerPreview

Visit localhost:3000/rails/mailers

Public Instance Methods

poll_end() click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 20
def poll_end
  poll_notification = build_poll_notification('The poll has ended')
  Effective::PollsMailer.poll_end(poll_notification, build_user)
end
poll_reminder() click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 15
def poll_reminder
  poll_notification = build_poll_notification('The poll started already and you have not participated')
  Effective::PollsMailer.poll_reminder(poll_notification, build_user)
end
poll_start() click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 10
def poll_start
  poll_notification = build_poll_notification('The poll has started')
  Effective::PollsMailer.poll_start(poll_notification, build_user)
end
poll_upcoming_reminder() click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 5
def poll_upcoming_reminder
  poll_notification = build_poll_notification('The poll will start soon')
  Effective::PollsMailer.poll_upcoming_reminder(poll_notification, build_user)
end

Protected Instance Methods

build_poll_notification(text) click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 39
def build_poll_notification(text)
  poll = Effective::Poll.new(start_at: Time.zone.now)
  Effective::PollNotification.new(poll: poll, body: text, subject: text)
end
build_user() click to toggle source
# File lib/generators/templates/effective_polls_mailer_preview.rb, line 27
def build_user
  User.new(email: 'buyer@website.com').tap do |user|
    user.name = 'Valued Customer' if user.respond_to?(:name=)
    user.full_name = 'Valued Customer' if user.respond_to?(:full_name=)

    if user.respond_to?(:first_name=) && user.respond_to?(:last_name=)
      user.first_name = 'Valued'
      user.last_name = 'Customer'
    end
  end
end