Class: Gitlab::QA::Slack::PostToSlack
- Inherits:
-
Object
- Object
- Gitlab::QA::Slack::PostToSlack
- Defined in:
- lib/gitlab/qa/slack/post_to_slack.rb
Instance Method Summary collapse
-
#initialize(message:, icon_emoji: Runtime::Env.slack_icon_emoji, channel: Runtime::Env.slack_qa_channel) ⇒ PostToSlack
constructor
A new instance of PostToSlack.
- #invoke! ⇒ Object
Constructor Details
#initialize(message:, icon_emoji: Runtime::Env.slack_icon_emoji, channel: Runtime::Env.slack_qa_channel) ⇒ PostToSlack
Returns a new instance of PostToSlack.
7 8 9 10 11 |
# File 'lib/gitlab/qa/slack/post_to_slack.rb', line 7 def initialize(message:, icon_emoji: Runtime::Env.slack_icon_emoji, channel: Runtime::Env.slack_qa_channel) @channel = channel @message = @icon_emoji = icon_emoji end |
Instance Method Details
#invoke! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/qa/slack/post_to_slack.rb', line 13 def invoke! Runtime::Env.require_slack_qa_channel! unless @channel Runtime::Env.require_ci_slack_webhook_url! params = {} params['channel'] = @channel params['username'] = "GitLab QA Bot" params['icon_emoji'] = @icon_emoji params['text'] = @message url = Runtime::Env.ci_slack_webhook_url Support::HttpRequest.make_http_request(method: 'post', url: url, params: params, show_response: true) end |