Class: Solicit::PostToSlack
- Inherits:
-
Object
- Object
- Solicit::PostToSlack
- Defined in:
- app/use_cases/solicit/post_to_slack.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
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.
5 6 7 8 9 10 11 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 5 def initialize(url:, channel:, username:, payload:) @url = url @channel = channel @username = username @payload = payload @text = I18n.t(:"engines.solicit.title", ) end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 3 def text @text end |
Class Method Details
.perform(*args) ⇒ Object
13 14 15 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 13 def self.perform(*args) new(*args).tap(&:perform) end |
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/use_cases/solicit/post_to_slack.rb', line 17 def perform Slack::Notifier.new(@url, channel: @channel, username: @username).ping( text: text, attachments: [{ title: I18n.t(:"engines.solicit.review"), callback_id: callback_id, color: :warning, actions: [claim_action], }] ) end |