fluent-plugin-typetalk 0.0.6 → 0.0.7
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 +8 -8
- data/fluent-plugin-typetalk.gemspec +1 -1
- data/lib/fluent/plugin/out_typetalk.rb +4 -1
- data/test/plugin/test_out_typetalk.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWQzZGQzYjc3MTdlYzNkMDdjZDk5Yjg0OWI4OTU5N2IxZDM0ZDFiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWFjMDJhOWVjMjY1NjcwMGYyYmM5YjdiOGUzZmZmN2E3NDAyNzBiYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGJlMTlmOWQ1YjVjNjQ5YTA3OGIxMDk4MDNjYjIyYTlkNzU4OGZmZGUwZjE2
|
10
|
+
ZTcyMmQ2OTBjMGY2Yzk1MjEyZDFjZWExYjYzYzBlNGRhMzUwNDVhNmVkZDE5
|
11
|
+
ZDgwMzVjNTZiNTkyOTM5MjA2YWFkNjUzNmJkM2EzZWExOTRmZTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmNjODJhNTY2ZjhlZGFmNWEyYmFhZjA5Nzk4Y2Y4OWM0YzEyMmQ5MTNlYTJi
|
14
|
+
NTMxMDgyYTM2ZDZmZTRmOWE5OGU5MmIzODRjNTdjNWM1YzI0OGM2YjEwMzY4
|
15
|
+
NTUwNGU2ZWQzNmU4OTUyNWM1Y2YwZjA5OTg5NzJkN2M3NjY2YzE=
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-typetalk"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.7"
|
8
8
|
spec.authors = ["tksmd","umakoz"]
|
9
9
|
spec.email = ["someda@isenshi.com"]
|
10
10
|
spec.description = %q{fluent plugin to send message to typetalk}
|
@@ -120,10 +120,13 @@ module Fluent
|
|
120
120
|
# https://developer.nulab-inc.com/docs/typetalk/auth#client
|
121
121
|
if body.has_key?('error')
|
122
122
|
msg = body['error']
|
123
|
-
|
123
|
+
elsif body.has_key?('errors')
|
124
124
|
msg = body['errors'].map{|f|
|
125
125
|
f['field'] + ' : ' + f['message']
|
126
126
|
}.join(',')
|
127
|
+
elsif !res['headers'].nil?
|
128
|
+
headers = JSON.parse(res['headers']) rescue {}
|
129
|
+
msg = headers['www-authenticate']
|
127
130
|
end
|
128
131
|
|
129
132
|
end
|
@@ -143,6 +143,20 @@ class TypetalkOutputTest < Test::Unit::TestCase
|
|
143
143
|
d.run()
|
144
144
|
end
|
145
145
|
|
146
|
+
def test_oauth2_error
|
147
|
+
d = create_driver()
|
148
|
+
stub(d.instance.typetalk).post_message(1, 'notice : test1') {
|
149
|
+
raise Typetalk::InvalidRequest, {status:400, headers:'{"www-authenticate": "Bearer error=\"invalid_scope\""}', body:""}.to_json
|
150
|
+
}
|
151
|
+
stub(d.instance.log).error {|name, params|
|
152
|
+
assert_equal "out_typetalk:", name
|
153
|
+
assert_equal Fluent::TypetalkError, params[:error_class]
|
154
|
+
assert_equal "failed to post, msg: Bearer error=\"invalid_scope\", code: 400", params[:error]
|
155
|
+
}
|
156
|
+
d.emit({'message' => 'test1'})
|
157
|
+
d.run()
|
158
|
+
end
|
159
|
+
|
146
160
|
def test_throttle
|
147
161
|
d = create_driver(CONFIG_THROTTLE)
|
148
162
|
mock(d.instance.typetalk).post_message(1, 'notice : test1')
|