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
194 195 196 |
# File 'lib/fluent/plugin/slack_client.rb', line 194 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
230 231 232 233 |
# File 'lib/fluent/plugin/slack_client.rb', line 230 def channels_create(params = {}, opts = {}) log.info { "out_slack: channels_create #{filter_params(params)}" } post(channels_create_endpoint, params) end |
#channels_create_endpoint ⇒ Object
206 207 208 |
# File 'lib/fluent/plugin/slack_client.rb', line 206 def channels_create_endpoint @channels_create_endpoint ||= URI.join(endpoint, "channels.create") end |
#endpoint ⇒ Object
198 199 200 |
# File 'lib/fluent/plugin/slack_client.rb', line 198 def endpoint @endpoint ||= URI.parse(DEFAULT_ENDPOINT) end |
#post_message(params = {}, opts = {}) ⇒ Object
Sends a message to a channel.
215 216 217 218 219 220 |
# File 'lib/fluent/plugin/slack_client.rb', line 215 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
202 203 204 |
# File 'lib/fluent/plugin/slack_client.rb', line 202 def @post_message_endpoint ||= URI.join(endpoint, "chat.postMessage") end |