Class: RakeSlack::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_slack/client.rb

Constant Summary collapse

URL =
'https://slack.com/api/chat.postMessage'

Instance Method Summary collapse

Constructor Details

#initialize(bot_token) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/rake_slack/client.rb', line 12

def initialize(bot_token)
  @bot_token = bot_token
end

Instance Method Details

#post_message(payload) ⇒ Object



16
17
18
19
20
21
# File 'lib/rake_slack/client.rb', line 16

def post_message(payload)
  assert_ok(execute_post(payload))
rescue Excon::Error, SystemCallError, JSON::ParserError => e
  raise RakeSlack::Exceptions::DeliveryFailed,
        "Slack chat.postMessage failed: #{e.message}"
end