Class: Solicit::PostToSlack
- Inherits:
-
Object
- Object
- Solicit::PostToSlack
- Defined in:
- app/use_cases/solicit/post_to_slack.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url:, channel:, username:, payload:) ⇒ PostToSlack
constructor
A new instance of PostToSlack.
- #perform ⇒ Object
Constructor Details
#initialize(url:, channel:, username:, payload:) ⇒ PostToSlack
Returns a new instance of PostToSlack.
4 5 6 7 8 9 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 4 def initialize(url:, channel:, username:, payload:) @url = url @channel = channel @username = username @payload = payload end |
Class Method Details
.perform(*args) ⇒ Object
11 12 13 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 11 def self.perform(*args) new(*args).perform end |
Instance Method Details
#perform ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 15 def perform Slack::Notifier.new(@url, channel: @channel, username: @username).ping( text: I18n.t(:"engines.solicit.title", link: @payload.dig(:pull_request, :html_url), title: @payload.dig(:pull_request, :title), label: @payload.dig(:label, :name) ), attachments: [{ title: I18n.t(:"engines.solicit.review"), callback_id: [ @payload.dig(:repository, :url), 'issues', @payload.dig(:pull_request, :number), 'assignees', ].join('/'), color: :warning, actions: [{ name: :claim, text: I18n.t(:"engines.solicit.claim"), type: :button, value: @payload.dig(:label, :name), }], }] ) end |