Class: Specular::Integration::Slack

Inherits:
Base
  • Object
show all
Defined in:
lib/specular/integration/slack.rb

Instance Method Summary collapse

Methods inherited from Base

arguments, handler

Constructor Details

#initialize(slack_token:, slack_channel:) ⇒ Slack

Returns a new instance of Slack.



7
8
9
10
11
12
13
14
15
16
# File 'lib/specular/integration/slack.rb', line 7

def initialize(slack_token:, slack_channel:)
  @slack_token = slack_token
  @slack_channel = slack_channel

  Slack::Web::Client.configure do |config|
    config.token = slack_token
  end

  @client = Slack::Web::Client.new
end

Instance Method Details

#post_message!(message:) ⇒ Object



18
19
20
21
22
23
# File 'lib/specular/integration/slack.rb', line 18

def post_message!(message:)
  @client.chat_postMessage(
    channel: @slack_channel,
    text: message
  )
end