fluent-plugin-slack 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.fluentd.0.12 +4 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_slack.rb +18 -0
- data/test/test_helper.rb +1 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 401cd80a470edd2acf64f3530ee125df42fa9393
|
4
|
+
data.tar.gz: 3c4238b53bf9ded7336eaf4148e572f1b18a9cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6b4662dfe23aefb7ebaf856b413e025d09ff0efa43ad75cd764129024a055ac280dfb32d94f5d2771e5d721e4c23d2163fb125776ee4e520f945019b1c017b
|
7
|
+
data.tar.gz: be176edc0387bc6848214744931250aff8b38078ba2b4cd0ac1f7a086b81919b26237d5de446dcd85230a03c0fea4424ff72c0a63aa8117ee35a36227b9d962f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,6 +68,7 @@ fluent_logger.post('slack', {
|
|
68
68
|
|webhook_url|Incoming Webhook URI (Required for Incoming Webhook mode). See https://api.slack.com/incoming-webhooks||
|
69
69
|
|slackbot_url|Slackbot URI (Required for Slackbot mode). See https://api.slack.com/slackbot. NOTE: most of optional parameters such as `username`, `color`, `icon_emoji`, `icon_url`, and `title` are not available for this mode, but Desktop Notification via Highlight Words works with only this mode||
|
70
70
|
|token|Token for Web API (Required for Web API mode). See https://api.slack.com/web||
|
71
|
+
|as_user|post messages as a bot user. See https://api.slack.com/bot-users#post_messages_and_react_to_users. NOTE: This parameter is only enabled if you use the Web API with your bot token. You cannot use both of `username` and `icon_emoji`(`icon_url`) when you set this parameter to `true`.|nil|
|
71
72
|
|username|name of bot|nil|
|
72
73
|
|color|color to use such as `good` or `bad`. See `Color` section of https://api.slack.com/docs/attachments. NOTE: This parameter must **not** be specified to receive Desktop Notification via Mentions in cases of Incoming Webhook and Slack Web API|nil|
|
73
74
|
|icon_emoji|emoji to use as the icon. either of `icon_emoji` or `icon_url` can be specified|nil|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.4
|
@@ -48,6 +48,13 @@ DESC
|
|
48
48
|
desc <<-DESC
|
49
49
|
Emoji to use as the icon.
|
50
50
|
Either of `icon_emoji` or `icon_url` can be specified.
|
51
|
+
DESC
|
52
|
+
config_param :as_user, :bool, default: nil
|
53
|
+
desc <<-DESC
|
54
|
+
Post message as the authenticated user.
|
55
|
+
NOTE: This parameter is only enabled if you use the Web API with your bot token.
|
56
|
+
You cannot use both of `username` and `icon_emoji`(`icon_url`) when
|
57
|
+
you set this parameter to `true`.
|
51
58
|
DESC
|
52
59
|
config_param :icon_emoji, :string, default: nil
|
53
60
|
desc <<-DESC
|
@@ -133,6 +140,9 @@ DESC
|
|
133
140
|
if @webhook_url.empty?
|
134
141
|
raise Fluent::ConfigError.new("`webhook_url` is an empty string")
|
135
142
|
end
|
143
|
+
unless @as_user.nil?
|
144
|
+
log.warn "out_slack: `as_user` parameter are not available for Incoming Webhook"
|
145
|
+
end
|
136
146
|
@slack = Fluent::SlackClient::IncomingWebhook.new(@webhook_url)
|
137
147
|
elsif @slackbot_url
|
138
148
|
if @slackbot_url.empty?
|
@@ -141,6 +151,9 @@ DESC
|
|
141
151
|
if @username or @color or @icon_emoji or @icon_url
|
142
152
|
log.warn "out_slack: `username`, `color`, `icon_emoji`, `icon_url` parameters are not available for Slackbot Remote Control"
|
143
153
|
end
|
154
|
+
unless @as_user.nil?
|
155
|
+
log.warn "out_slack: `as_user` parameter are not available for Slackbot Remote Control"
|
156
|
+
end
|
144
157
|
@slack = Fluent::SlackClient::Slackbot.new(@slackbot_url)
|
145
158
|
elsif @token
|
146
159
|
if @token.empty?
|
@@ -183,6 +196,10 @@ DESC
|
|
183
196
|
raise Fluent::ConfigError, "either of `icon_emoji` or `icon_url` can be specified"
|
184
197
|
end
|
185
198
|
|
199
|
+
if @as_user and (@icon_emoji or @icon_url or @username)
|
200
|
+
raise Fluent::ConfigError, "`username`, `icon_emoji` and `icon_url` cannot be specified when `as_user` is set to true"
|
201
|
+
end
|
202
|
+
|
186
203
|
if @mrkdwn
|
187
204
|
# Enable markdown for attachments. See https://api.slack.com/docs/formatting
|
188
205
|
@mrkdwn_in = %w[text fields]
|
@@ -232,6 +249,7 @@ DESC
|
|
232
249
|
def common_payload
|
233
250
|
return @common_payload if @common_payload
|
234
251
|
@common_payload = {}
|
252
|
+
@common_payload[:as_user] = @as_user unless @as_user.nil?
|
235
253
|
@common_payload[:username] = @username if @username
|
236
254
|
@common_payload[:icon_emoji] = @icon_emoji if @icon_emoji
|
237
255
|
@common_payload[:icon_url] = @icon_url if @icon_url
|
data/test/test_helper.rb
CHANGED
@@ -9,6 +9,7 @@ rescue Bundler::BundlerError => e
|
|
9
9
|
exit e.status_code
|
10
10
|
end
|
11
11
|
require 'test/unit'
|
12
|
+
require 'test/unit/rr'
|
12
13
|
|
13
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
@@ -29,5 +30,3 @@ def with_timezone(tz)
|
|
29
30
|
ensure
|
30
31
|
ENV['TZ'] = oldtz
|
31
32
|
end
|
32
|
-
|
33
|
-
require 'rr'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-slack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keisuke SOGAWA
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- ".travis.yml"
|
136
136
|
- CHANGELOG.md
|
137
137
|
- Gemfile
|
138
|
+
- Gemfile.fluentd.0.12
|
138
139
|
- README.md
|
139
140
|
- Rakefile
|
140
141
|
- VERSION
|