Class: Slack::Mailer::DeliveryWorker

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



16
17
18
# File 'lib/slack_mailer/delivery_worker.rb', line 16

def channel
  @channel
end

#messageObject

Returns the value of attribute message.



16
17
18
# File 'lib/slack_mailer/delivery_worker.rb', line 16

def message
  @message
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/slack_mailer/delivery_worker.rb', line 16

def name
  @name
end

#retry_countObject

Returns the value of attribute retry_count.



16
17
18
# File 'lib/slack_mailer/delivery_worker.rb', line 16

def retry_count
  @retry_count
end

#urlObject

Returns the value of attribute url.



16
17
18
# File 'lib/slack_mailer/delivery_worker.rb', line 16

def url
  @url
end

Instance Method Details

#perform(params) ⇒ Object



22
23
24
25
26
# File 'lib/slack_mailer/delivery_worker.rb', line 22

def perform(params)
  params['url'] = Slack::Mailer::Configuration.config.slack_hook_urls[retry_count]
  params.each{ |attribute, value| send("#{attribute}=", value) if respond_to?(attribute) }
  Slack::Notifier.new(url, username: name, channel: channel, link_names: 1).ping(message)
end