Class: Fluent::SlackClient::Slackbot

Inherits:
Base
  • Object
show all
Defined in:
lib/fluent/plugin/slack_client.rb

Overview

Slack client for Slackbot Remote Control api.slack.com/slackbot

Instance Attribute Summary

Attributes inherited from Base

#debug_dev, #endpoint, #https_proxy, #log

Instance Method Summary collapse

Methods inherited from Base

#post, #proxy_class

Constructor Details

#initialize(endpoint, https_proxy = nil) ⇒ Slackbot

Returns a new instance of Slackbot.



161
162
163
# File 'lib/fluent/plugin/slack_client.rb', line 161

def initialize(endpoint, https_proxy = nil)
  super
end

Instance Method Details

#apiObject



165
166
167
# File 'lib/fluent/plugin/slack_client.rb', line 165

def api
  @api ||= WebApi.new(nil, https_proxy)
end

#post_message(params = {}, opts = {}) ⇒ Object

Raises:

  • (ArgumentError)


169
170
171
172
173
174
175
# File 'lib/fluent/plugin/slack_client.rb', line 169

def post_message(params = {}, opts = {})
  raise ArgumentError, "channel parameter is required" unless params[:channel]
  with_channels_create(params, opts) do
    log.info { "out_slack: post_message #{filter_params(params)}" }
    post(slackbot_endpoint(params), params)
  end
end