Sha256: 71ee7e6591b488b9e0dba8b46cf1e1740b717465ef2c0afefb097316cc04a080

Contents?: true

Size: 914 Bytes

Versions: 77

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module GitlabQuality
  module TestTooling
    module Slack
      class PostToSlack
        def initialize(slack_webhook_url:, channel:, message:, username:, icon_emoji:)
          @slack_webhook_url = slack_webhook_url
          @channel = channel
          @message = message
          @username = username
          @icon_emoji = icon_emoji
        end

        def invoke!
          params = {}
          params['channel'] = channel
          params['username'] = username
          params['icon_emoji'] = icon_emoji
          params['text'] = message

          Support::HttpRequest.make_http_request(
            method: 'post',
            url: slack_webhook_url,
            params: params,
            show_response: true
          )
        end

        private

        attr_reader :slack_webhook_url, :channel, :message, :username, :icon_emoji
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.10.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.9.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.8.1 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.8.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.7.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.5.4 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.5.3 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.5.2 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.5.1 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.5.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.4.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.3.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.2.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.1.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-1.0.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-0.9.3 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-0.9.2 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-0.9.1 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-0.9.0 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb
gitlab_quality-test_tooling-0.8.3 lib/gitlab_quality/test_tooling/slack/post_to_slack.rb