Class: MailyHerald::Async

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/maily_herald.rb

Instance Method Summary collapse

Instance Method Details

#perform(args = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/maily_herald.rb', line 19

def perform args = {}
  if args["logger"]
    logger_opts = {level: args["logger"]["level"], progname: "bkg"}
    logger_opts[:target] = args["logger"]["target"]
    MailyHerald::Logging.initialize(logger_opts)
  end

  if args["mailing"]
    MailyHerald::Manager.run_mailing args["mailing"]
  elsif args["sequence"]
    MailyHerald::Manager.run_sequence args["sequence"]
  else
    MailyHerald::Manager.run_all
  end
end