22 lines
421 B
Ruby
22 lines
421 B
Ruby
# frozen_string_literal: true
|
|
|
|
class IntroduceAccountProWorker
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: 'mailers', retry: 2
|
|
|
|
attr_reader :user
|
|
|
|
def perform(acct_id, date_range)
|
|
@acct = Account.find(acct_id)
|
|
deliver_email(date_range)
|
|
end
|
|
|
|
private
|
|
|
|
def deliver_email(date_range)
|
|
UserMailer.introduce_pro(@acct.user, date_range).deliver_now!
|
|
@acct.user.touch(:last_emailed_at)
|
|
end
|
|
end
|