Class: Newsly::NewsletterSender

Inherits:
Object
  • Object
show all
Defined in:
app/workers/newsly/newsletter_sender.rb

Class Method Summary collapse

Class Method Details

.perform(newsletter_id, recipient_groups) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/workers/newsly/newsletter_sender.rb', line 4

def self.perform(newsletter_id, recipient_groups)
  for group in recipient_groups
   Newsly.get_newsletter_receipient_group(group.to_sym).call(newsletter_id).find_each(:batch_size => 1000) do |resource|
     Newsly::Mailer.async_deliver.build_newsletter(newsletter_id, resource.send(Newsly.resource_email_column), resource.to_liquid)
   end
	end

end