Class: Fluent::SlackClient::WebApi
- Defined in:
- lib/fluent/plugin/slack_client.rb
Overview
Slack client for Web API
Constant Summary collapse
- DEFAULT_ENDPOINT =
"https://slack.com/api/".freeze
Instance Attribute Summary
Attributes inherited from Base
#debug_dev, #https_proxy, #log
Instance Method Summary collapse
- #api ⇒ Object
-
#channels_create(params = {}, opts = {}) ⇒ Object
Creates a channel.
- #channels_create_endpoint ⇒ Object
- #endpoint ⇒ Object
-
#post_message(params = {}, opts = {}) ⇒ Object
Sends a message to a channel.
- #post_message_endpoint ⇒ Object
Methods inherited from Base
#initialize, #post, #proxy_class
Constructor Details
This class inherits a constructor from Fluent::SlackClient::Base
Instance Method Details
#api ⇒ Object
223 224 225 |
# File 'lib/fluent/plugin/slack_client.rb', line 223 def api self end |
#channels_create(params = {}, opts = {}) ⇒ Object
Creates a channel.
NOTE: Bot user can not create a channel. Token must be issued by Normal User Account
259 260 261 262 |
# File 'lib/fluent/plugin/slack_client.rb', line 259 def channels_create(params = {}, opts = {}) log.info { "out_slack: channels_create #{filter_params(params)}" } post(channels_create_endpoint, params) end |
#channels_create_endpoint ⇒ Object
235 236 237 |
# File 'lib/fluent/plugin/slack_client.rb', line 235 def channels_create_endpoint @channels_create_endpoint ||= URI.join(endpoint, "channels.create") end |
#endpoint ⇒ Object
227 228 229 |
# File 'lib/fluent/plugin/slack_client.rb', line 227 def endpoint @endpoint ||= URI.parse(DEFAULT_ENDPOINT) end |
#post_message(params = {}, opts = {}) ⇒ Object
Sends a message to a channel.
244 245 246 247 248 249 |
# File 'lib/fluent/plugin/slack_client.rb', line 244 def (params = {}, opts = {}) with_channels_create(params, opts) do log.info { "out_slack: post_message #{filter_params(params)}" } post(, params) end end |
#post_message_endpoint ⇒ Object
231 232 233 |
# File 'lib/fluent/plugin/slack_client.rb', line 231 def @post_message_endpoint ||= URI.join(endpoint, "chat.postMessage") end |