Class: Solicit::PostToSlack

Inherits:
Object
  • Object
show all
Defined in:
app/use_cases/solicit/post_to_slack.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, channel:, username:, payload:) ⇒ PostToSlack

Returns a new instance of PostToSlack.



3
4
5
6
7
8
# File 'app/use_cases/solicit/post_to_slack.rb', line 3

def initialize(url:, channel:, username:, payload:)
  @url      = url
  @channel  = channel
  @username = username
  @payload  = payload
end

Class Method Details

.perform(*args) ⇒ Object



10
11
12
# File 'app/use_cases/solicit/post_to_slack.rb', line 10

def self.perform(*args)
  new(*args).perform
end

Instance Method Details

#performObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/use_cases/solicit/post_to_slack.rb', line 14

def perform
  Slack::Notifier.new(@url, channel: @channel, username: @username).ping(
    text: I18n.t(:"engines.solicit.title", title_options),
    attachments: [{
      title: I18n.t(:"engines.solicit.review"),
      callback_id: callback_id,
      color: :warning,
      actions: Array(claim_action),
    }]
  )
end