fluent-plugin-twitter 0.6.0 → 0.6.1
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 +7 -0
- data/.travis.yml +2 -17
- data/Appraisals +0 -8
- data/README.md +9 -6
- data/fluent-plugin-twitter.gemspec +5 -5
- data/lib/fluent/plugin/in_twitter.rb +52 -65
- data/lib/fluent/plugin/out_twitter.rb +14 -25
- data/test/helper.rb +2 -17
- data/test/plugin/test_in_twitter.rb +50 -38
- data/test/plugin/test_out_twitter.rb +22 -29
- metadata +26 -62
- data/gemfiles/fluentd_v0.10.gemfile +0 -7
- data/gemfiles/fluentd_v0.12.gemfile +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b1e658b7db60b26ce58747d37000b8fd4116116
|
4
|
+
data.tar.gz: c68743476f6ca3b9d6c6842d75ee7f45d155615b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dae43c14a04a6d1d1d28b79a3fe174879796c237e884314e4a6bd1d28eeb2dc0a1ad03aecd45138540abce45890df61b75ae611038b93aec86362e8432a2179f
|
7
|
+
data.tar.gz: 9e4c2dd35b8c3d1ab269450cba3728be10e51e7ea876e63a0a10fcedbc9ea06cba88eb0d4a86f617627bac8f1bc6bb8619d606ad14e15cb2dde27a8de1fed131
|
data/.travis.yml
CHANGED
@@ -2,7 +2,8 @@ sudo: false
|
|
2
2
|
language: ruby
|
3
3
|
|
4
4
|
rvm:
|
5
|
-
- 2.
|
5
|
+
- 2.4.1
|
6
|
+
- 2.3.4
|
6
7
|
- 2.2.5
|
7
8
|
- 2.1.10
|
8
9
|
|
@@ -11,20 +12,4 @@ before_install:
|
|
11
12
|
|
12
13
|
gemfile:
|
13
14
|
- Gemfile
|
14
|
-
- gemfiles/fluentd_v0.10.gemfile
|
15
|
-
- gemfiles/fluentd_v0.12.gemfile
|
16
15
|
- gemfiles/fluentd_v0.14.gemfile
|
17
|
-
|
18
|
-
matrix:
|
19
|
-
include:
|
20
|
-
- rvm: 2.0.0
|
21
|
-
gemfile: gemfiles/fluentd_v0.10.gemfile
|
22
|
-
- rvm: 2.0.0
|
23
|
-
gemfile: gemfiles/fluentd_v0.12.gemfile
|
24
|
-
exclude:
|
25
|
-
- rvm: 2.3.1
|
26
|
-
gemfile: gemfiles/fluentd_v0.10.gemfile
|
27
|
-
- rvm: 1.9.3
|
28
|
-
gemfile: gemfiles/fluentd_v0.10.gemfile
|
29
|
-
- rvm: 1.9.3
|
30
|
-
gemfile: gemfiles/fluentd_v0.12.gemfile
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -16,22 +16,25 @@ $ sudo yum -y install gcc gcc-c++ openssl-devel libcurl libcurl-devel
|
|
16
16
|
$ sudo apt-get install build-essential libssl-dev
|
17
17
|
```
|
18
18
|
|
19
|
+
## Requirements
|
20
|
+
|
21
|
+
| fluent-plugin-twitter | fluentd | ruby |
|
22
|
+
|--------------------|------------|--------|
|
23
|
+
| 0.6.1 | v0.14.x | >= 2.1 |
|
24
|
+
| 0.5.4 | v0.12.x | >= 1.9 |
|
25
|
+
|
19
26
|
## Installation
|
20
27
|
|
21
|
-
install with `gem` or `
|
28
|
+
install with `gem` or `td-agent-gem` command as:
|
22
29
|
|
23
30
|
```
|
24
31
|
# for fluentd
|
25
32
|
$ gem install eventmachine
|
26
33
|
$ gem install fluent-plugin-twitter
|
27
34
|
|
28
|
-
# for td-agent
|
29
|
-
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install eventmachine
|
30
|
-
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-twitter -v 0.6.0
|
31
|
-
|
32
35
|
# for td-agent2
|
33
36
|
$ sudo td-agent-gem install eventmachine
|
34
|
-
$ sudo td-agent-gem install fluent-plugin-twitter -v 0.
|
37
|
+
$ sudo td-agent-gem install fluent-plugin-twitter -v 0.5.4
|
35
38
|
```
|
36
39
|
|
37
40
|
## Input Configuration
|
@@ -1,9 +1,8 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
$:.push File.expand_path("../lib", __FILE__)
|
3
2
|
|
4
3
|
Gem::Specification.new do |s|
|
5
4
|
s.name = "fluent-plugin-twitter"
|
6
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.1"
|
7
6
|
s.authors = ["Kentaro Yoshida"]
|
8
7
|
s.email = ["y.ken.studio@gmail.com"]
|
9
8
|
s.homepage = "https://github.com/y-ken/fluent-plugin-twitter"
|
@@ -15,11 +14,12 @@ Gem::Specification.new do |s|
|
|
15
14
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
15
|
s.require_paths = ["lib"]
|
17
16
|
|
17
|
+
s.required_ruby_version = "> 2.1"
|
18
|
+
|
18
19
|
s.add_development_dependency "rake"
|
19
20
|
s.add_development_dependency "test-unit", ">= 3.1.0"
|
20
21
|
s.add_development_dependency "appraisal"
|
21
22
|
|
22
|
-
s.add_runtime_dependency "fluentd", [">= 0.
|
23
|
-
s.add_runtime_dependency "twitter", "~>
|
24
|
-
s.add_runtime_dependency "string-scrub", [">= 0.0.3", "<= 0.0.5"]
|
23
|
+
s.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
|
24
|
+
s.add_runtime_dependency "twitter", "~> 6.0"
|
25
25
|
end
|
@@ -1,47 +1,38 @@
|
|
1
|
+
require "fluent/plugin/input"
|
2
|
+
|
1
3
|
require 'twitter'
|
2
4
|
require 'nkf'
|
3
|
-
require 'string/scrub' if RUBY_VERSION.to_f < 2.1
|
4
5
|
|
5
|
-
|
6
|
+
module Fluent::Plugin
|
7
|
+
class TwitterInput < Fluent::Plugin::Input
|
8
|
+
Fluent::Plugin.register_input('twitter', self)
|
6
9
|
|
7
|
-
|
8
|
-
class TwitterInput < Fluent::Input
|
9
|
-
TIMELINE_TYPE = %w(userstream sampling location tracking)
|
10
|
-
OUTPUT_FORMAT_TYPE = %w(nest flat simple)
|
11
|
-
Plugin.register_input('twitter', self)
|
10
|
+
helpers :thread
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
define_method("router") { Fluent::Engine }
|
16
|
-
end
|
12
|
+
TIMELINE_TYPE = %i(userstream sampling location tracking)
|
13
|
+
OUTPUT_FORMAT_TYPE = %i(nest flat simple)
|
17
14
|
|
18
|
-
config_param :consumer_key, :string, :
|
19
|
-
config_param :consumer_secret, :string, :
|
20
|
-
config_param :access_token, :string, :
|
21
|
-
config_param :access_token_secret, :string, :
|
15
|
+
config_param :consumer_key, :string, secret: true
|
16
|
+
config_param :consumer_secret, :string, secret: true
|
17
|
+
config_param :access_token, :string, secret: true
|
18
|
+
config_param :access_token_secret, :string, secret: true
|
22
19
|
config_param :tag, :string
|
23
|
-
config_param :timeline, :
|
24
|
-
config_param :keyword, :string, :
|
25
|
-
config_param :follow_ids, :string, :
|
26
|
-
config_param :locations, :string, :
|
27
|
-
config_param :lang, :string, :
|
28
|
-
config_param :output_format, :
|
29
|
-
config_param :flatten_separator, :string, :
|
20
|
+
config_param :timeline, :enum, list: TIMELINE_TYPE
|
21
|
+
config_param :keyword, :string, default: nil
|
22
|
+
config_param :follow_ids, :string, default: nil
|
23
|
+
config_param :locations, :string, default: nil
|
24
|
+
config_param :lang, :string, default: nil
|
25
|
+
config_param :output_format, :enum, list: OUTPUT_FORMAT_TYPE, default: :simple
|
26
|
+
config_param :flatten_separator, :string, default: '_'
|
30
27
|
|
31
28
|
def initialize
|
32
29
|
super
|
30
|
+
@running = false
|
33
31
|
end
|
34
32
|
|
35
33
|
def configure(conf)
|
36
34
|
super
|
37
35
|
|
38
|
-
if !TIMELINE_TYPE.include?(@timeline)
|
39
|
-
raise Fluent::ConfigError, "timeline value undefined #{@timeline}"
|
40
|
-
end
|
41
|
-
if !OUTPUT_FORMAT_TYPE.include?(@output_format)
|
42
|
-
raise Fluent::ConfigError, "output_format value undefined #{@output_format}"
|
43
|
-
end
|
44
|
-
|
45
36
|
@keyword = @keyword.gsub('${hashtag}', '#') unless @keyword.nil?
|
46
37
|
|
47
38
|
@client = Twitter::Streaming::Client.new do |config|
|
@@ -53,11 +44,15 @@ module Fluent
|
|
53
44
|
end
|
54
45
|
|
55
46
|
def start
|
56
|
-
@
|
47
|
+
@running = true
|
48
|
+
thread_create(:in_twitter) do
|
49
|
+
run
|
50
|
+
end
|
57
51
|
end
|
58
52
|
|
59
53
|
def shutdown
|
60
|
-
|
54
|
+
@running = false
|
55
|
+
super
|
61
56
|
end
|
62
57
|
|
63
58
|
def run
|
@@ -66,20 +61,21 @@ module Fluent
|
|
66
61
|
notice << " lang:#{@lang}" unless @lang.nil?
|
67
62
|
notice << " keyword:#{@keyword}" unless @keyword.nil?
|
68
63
|
notice << " follow:#{@follow_ids}" unless @follow_ids.nil? && !@keyword.nil?
|
69
|
-
|
64
|
+
log.info notice
|
70
65
|
|
71
|
-
if [
|
66
|
+
if [:sampling, :tracking].include?(@timeline) && @keyword
|
72
67
|
@client.filter(track: @keyword, &method(:handle_object))
|
73
|
-
elsif @timeline ==
|
68
|
+
elsif @timeline == :tracking && @follow_ids
|
74
69
|
@client.filter(follow: @follow_ids, &method(:handle_object))
|
75
|
-
elsif @timeline ==
|
70
|
+
elsif @timeline == :sampling && @keyword.nil? && @follow_ids.nil?
|
76
71
|
@client.sample(&method(:handle_object))
|
77
|
-
elsif @timeline ==
|
72
|
+
elsif @timeline == :userstream
|
78
73
|
@client.user(&method(:handle_object))
|
79
74
|
end
|
80
75
|
end
|
81
76
|
|
82
77
|
def handle_object(object)
|
78
|
+
return unless @running
|
83
79
|
if is_message?(object)
|
84
80
|
get_message(object)
|
85
81
|
end
|
@@ -88,7 +84,7 @@ module Fluent
|
|
88
84
|
def is_message?(tweet)
|
89
85
|
return false if !tweet.is_a?(Twitter::Tweet)
|
90
86
|
return false if (!@lang.nil? && @lang != '') && !@lang.include?(tweet.user.lang)
|
91
|
-
if @timeline ==
|
87
|
+
if @timeline == :userstream && (!@keyword.nil? && @keyword != '')
|
92
88
|
pattern = NKF::nkf('-WwZ1', @keyword).gsub(/,\s?/, '|')
|
93
89
|
tweet = NKF::nkf('-WwZ1', tweet.text)
|
94
90
|
return false if !Regexp.new(pattern, Regexp::IGNORECASE).match(tweet)
|
@@ -98,23 +94,23 @@ module Fluent
|
|
98
94
|
|
99
95
|
def get_message(tweet)
|
100
96
|
case @output_format
|
101
|
-
when
|
97
|
+
when :nest
|
102
98
|
record = hash_key_to_s(tweet.to_h)
|
103
|
-
when
|
99
|
+
when :flat
|
104
100
|
record = hash_flatten(tweet.to_h)
|
105
|
-
when
|
106
|
-
record =
|
107
|
-
record
|
108
|
-
record
|
109
|
-
record
|
110
|
-
record
|
111
|
-
record
|
112
|
-
record
|
113
|
-
record
|
114
|
-
record
|
115
|
-
record
|
101
|
+
when :simple
|
102
|
+
record = {}
|
103
|
+
record['message'] = tweet.text.scrub('')
|
104
|
+
record['geo'] = tweet.geo
|
105
|
+
record['place'] = tweet.place
|
106
|
+
record['created_at'] = tweet.created_at
|
107
|
+
record['user_name'] = tweet.user.name
|
108
|
+
record['user_screen_name'] = tweet.user.screen_name
|
109
|
+
record['user_profile_image_url'] = tweet.user.profile_image_url
|
110
|
+
record['user_time_zone'] = tweet.user.time_zone
|
111
|
+
record['user_lang'] = tweet.user.lang
|
116
112
|
end
|
117
|
-
router.emit(@tag, Engine.now, record)
|
113
|
+
router.emit(@tag, Fluent::Engine.now, record)
|
118
114
|
end
|
119
115
|
|
120
116
|
def hash_flatten(record, prefix = nil)
|
@@ -133,9 +129,9 @@ module Fluent
|
|
133
129
|
def hash_key_to_s(hash)
|
134
130
|
newhash = {}
|
135
131
|
hash.each do |k, v|
|
136
|
-
if v.instance_of?(Hash)
|
132
|
+
if v.instance_of?(Hash)
|
137
133
|
newhash[k.to_s] = hash_key_to_s(v)
|
138
|
-
elsif v.instance_of?(Array)
|
134
|
+
elsif v.instance_of?(Array)
|
139
135
|
newhash[k.to_s] = array_key_to_s(v)
|
140
136
|
elsif v.instance_of?(String)
|
141
137
|
newhash[k.to_s] = v.scrub('')
|
@@ -148,11 +144,11 @@ module Fluent
|
|
148
144
|
|
149
145
|
def array_key_to_s(array)
|
150
146
|
array.map do |v|
|
151
|
-
if v.instance_of?(Hash)
|
147
|
+
if v.instance_of?(Hash)
|
152
148
|
hash_key_to_s(v)
|
153
|
-
elsif v.instance_of?(Array)
|
149
|
+
elsif v.instance_of?(Array)
|
154
150
|
array_key_to_s(v)
|
155
|
-
elsif v.instance_of?(String)
|
151
|
+
elsif v.instance_of?(String)
|
156
152
|
v.scrub('')
|
157
153
|
else
|
158
154
|
v
|
@@ -161,12 +157,3 @@ module Fluent
|
|
161
157
|
end
|
162
158
|
end
|
163
159
|
end
|
164
|
-
|
165
|
-
# TODO: Remove this monkey patch after release new version of twitter gem
|
166
|
-
#
|
167
|
-
# See: https://github.com/sferik/twitter/pull/815
|
168
|
-
class Twitter::NullObject
|
169
|
-
def to_json(*args)
|
170
|
-
nil.to_json(*args)
|
171
|
-
end
|
172
|
-
end
|
@@ -1,51 +1,40 @@
|
|
1
|
-
require "
|
1
|
+
require "twitter"
|
2
|
+
require "fluent/plugin/output"
|
2
3
|
|
3
|
-
class Fluent::TwitterOutput < Fluent::Output
|
4
|
+
class Fluent::Plugin::TwitterOutput < Fluent::Plugin::Output
|
4
5
|
Fluent::Plugin.register_output('twitter', self)
|
5
6
|
|
6
|
-
config_param :consumer_key, :string, :
|
7
|
-
config_param :consumer_secret, :string, :
|
8
|
-
config_param :
|
9
|
-
config_param :
|
10
|
-
config_param :access_token, :string, :default => nil, :secret => true
|
11
|
-
config_param :access_token_secret, :string, :default => nil, :secret => true
|
7
|
+
config_param :consumer_key, :string, secret: true
|
8
|
+
config_param :consumer_secret, :string, secret: true
|
9
|
+
config_param :access_token, :string, secret: true
|
10
|
+
config_param :access_token_secret, :string, secret: true
|
12
11
|
|
13
12
|
def initialize
|
14
13
|
super
|
15
|
-
require 'twitter'
|
16
14
|
end
|
17
15
|
|
18
16
|
def configure(conf)
|
19
17
|
super
|
20
18
|
|
21
|
-
@access_token = @access_token || @oauth_token
|
22
|
-
@access_token_secret = @access_token_secret || @oauth_token_secret
|
23
|
-
if !@consumer_key or !@consumer_secret or !@access_token or !@access_token_secret
|
24
|
-
raise Fluent::ConfigError, "missing values in consumer_key or consumer_secret or oauth_token or oauth_token_secret"
|
25
|
-
end
|
26
|
-
|
27
19
|
@twitter = Twitter::REST::Client.new(
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
20
|
+
consumer_key: @consumer_key,
|
21
|
+
consumer_secret: @consumer_secret,
|
22
|
+
access_token: @access_token,
|
23
|
+
access_token_secret: @access_token_secret
|
32
24
|
)
|
33
25
|
end
|
34
26
|
|
35
|
-
def
|
36
|
-
es.each do |
|
27
|
+
def process(tag, es)
|
28
|
+
es.each do |_time, record|
|
37
29
|
tweet(record['message'])
|
38
30
|
end
|
39
|
-
|
40
|
-
chain.next
|
41
31
|
end
|
42
32
|
|
43
33
|
def tweet(message)
|
44
34
|
begin
|
45
35
|
@twitter.update(message)
|
46
36
|
rescue Twitter::Error => e
|
47
|
-
|
37
|
+
log.error("Twitter Error: #{e.message}")
|
48
38
|
end
|
49
39
|
end
|
50
40
|
end
|
51
|
-
|
data/test/helper.rb
CHANGED
@@ -1,21 +1,6 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift(File.join(
|
5
|
-
$LOAD_PATH.unshift(
|
4
|
+
$LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(__dir__)
|
6
6
|
require 'fluent/test'
|
7
|
-
unless ENV.has_key?('VERBOSE')
|
8
|
-
nulllogger = Object.new
|
9
|
-
nulllogger.instance_eval {|obj|
|
10
|
-
def method_missing(method, *args)
|
11
|
-
# pass
|
12
|
-
end
|
13
|
-
}
|
14
|
-
$log = nulllogger
|
15
|
-
end
|
16
|
-
|
17
|
-
require 'fluent/plugin/out_twitter'
|
18
|
-
require 'fluent/plugin/in_twitter'
|
19
|
-
|
20
|
-
class Test::Unit::TestCase
|
21
|
-
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'fluent/plugin/in_twitter'
|
3
|
+
require 'fluent/test/driver/input'
|
2
4
|
|
3
5
|
class TwitterInputTest < Test::Unit::TestCase
|
4
6
|
def setup
|
@@ -14,47 +16,57 @@ class TwitterInputTest < Test::Unit::TestCase
|
|
14
16
|
timeline sampling
|
15
17
|
]
|
16
18
|
|
17
|
-
def create_driver(conf=CONFIG,
|
18
|
-
Fluent::Test::
|
19
|
+
def create_driver(conf = CONFIG, syntax: :v1)
|
20
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::TwitterInput).configure(conf, syntax: syntax)
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
sub_test_case "v0 syntax" do
|
24
|
+
def test_empty
|
25
|
+
assert_raise(Fluent::ConfigError) {
|
26
|
+
create_driver('', syntax: :v0)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_configure
|
31
|
+
d = create_driver %[
|
32
|
+
consumer_key CONSUMER_KEY
|
33
|
+
consumer_secret CONSUMER_SECRET
|
34
|
+
access_token ACCESS_TOKEN
|
35
|
+
access_token_secret ACCESS_TOKEN_SECRET
|
36
|
+
tag input.twitter
|
37
|
+
timeline tracking
|
38
|
+
keyword ${hashtag}fluentd,fluentd lang:ja
|
39
|
+
]
|
40
|
+
assert_equal 'CONSUMER_KEY', d.instance.consumer_key
|
41
|
+
assert_equal 'CONSUMER_SECRET', d.instance.consumer_secret
|
42
|
+
assert_equal 'ACCESS_TOKEN', d.instance.access_token
|
43
|
+
assert_equal 'ACCESS_TOKEN_SECRET', d.instance.access_token_secret
|
44
|
+
assert_equal '#fluentd,fluentd lang:ja', d.instance.keyword
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
sub_test_case "v1 syntax" do
|
49
|
+
def test_empty
|
50
|
+
assert_raise(Fluent::ConfigError) {
|
51
|
+
create_driver('')
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_multi_keyword
|
56
|
+
d = create_driver(%[
|
57
|
+
consumer_key CONSUMER_KEY
|
58
|
+
consumer_secret CONSUMER_SECRET
|
59
|
+
access_token ACCESS_TOKEN
|
60
|
+
access_token_secret ACCESS_TOKEN_SECRET
|
61
|
+
tag input.twitter
|
62
|
+
timeline tracking
|
63
|
+
keyword 'treasuredata,treasure data,#treasuredata,fluentd,#fluentd'
|
64
|
+
])
|
65
|
+
assert_equal 'CONSUMER_KEY', d.instance.consumer_key
|
66
|
+
assert_equal 'CONSUMER_SECRET', d.instance.consumer_secret
|
67
|
+
assert_equal 'ACCESS_TOKEN', d.instance.access_token
|
68
|
+
assert_equal 'ACCESS_TOKEN_SECRET', d.instance.access_token_secret
|
69
|
+
assert_equal 'treasuredata,treasure data,#treasuredata,fluentd,#fluentd', d.instance.keyword
|
70
|
+
end
|
59
71
|
end
|
60
72
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'fluent/test/driver/output'
|
3
|
+
require 'fluent/plugin/out_twitter'
|
2
4
|
|
3
5
|
class TwitterOutputTest < Test::Unit::TestCase
|
4
6
|
def setup
|
@@ -12,37 +14,28 @@ class TwitterOutputTest < Test::Unit::TestCase
|
|
12
14
|
access_token_secret ACCESS_TOKEN_SECRET
|
13
15
|
]
|
14
16
|
|
15
|
-
def create_driver(conf=CONFIG
|
16
|
-
Fluent::Test::
|
17
|
+
def create_driver(conf = CONFIG)
|
18
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::TwitterOutput).configure(conf)
|
17
19
|
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
consumer_secret CONSUMER_SECRET
|
26
|
-
access_token ACCESS_TOKEN
|
27
|
-
access_token_secret ACCESS_TOKEN_SECRET
|
28
|
-
]
|
29
|
-
assert_equal 'CONSUMER_KEY', d.instance.consumer_key
|
30
|
-
assert_equal 'CONSUMER_SECRET', d.instance.consumer_secret
|
31
|
-
assert_equal 'ACCESS_TOKEN', d.instance.access_token
|
32
|
-
assert_equal 'ACCESS_TOKEN_SECRET', d.instance.access_token_secret
|
33
|
-
end
|
21
|
+
sub_test_case "configure" do
|
22
|
+
def test_empty
|
23
|
+
assert_raise(Fluent::ConfigError) {
|
24
|
+
create_driver('')
|
25
|
+
}
|
26
|
+
end
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
28
|
+
def test_configure
|
29
|
+
d = create_driver %[
|
30
|
+
consumer_key CONSUMER_KEY
|
31
|
+
consumer_secret CONSUMER_SECRET
|
32
|
+
access_token ACCESS_TOKEN
|
33
|
+
access_token_secret ACCESS_TOKEN_SECRET
|
34
|
+
]
|
35
|
+
assert_equal 'CONSUMER_KEY', d.instance.consumer_key
|
36
|
+
assert_equal 'CONSUMER_SECRET', d.instance.consumer_secret
|
37
|
+
assert_equal 'ACCESS_TOKEN', d.instance.access_token
|
38
|
+
assert_equal 'ACCESS_TOKEN_SECRET', d.instance.access_token_secret
|
39
|
+
end
|
46
40
|
end
|
47
41
|
end
|
48
|
-
|
metadata
CHANGED
@@ -1,124 +1,91 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kentaro Yoshida
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2017-
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: test-unit
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.1.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.1.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: appraisal
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: fluentd
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
70
|
-
- - <
|
61
|
+
version: 0.14.0
|
62
|
+
- - "<"
|
71
63
|
- !ruby/object:Gem::Version
|
72
64
|
version: '2'
|
73
65
|
type: :runtime
|
74
66
|
prerelease: false
|
75
67
|
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
68
|
requirements:
|
78
|
-
- -
|
69
|
+
- - ">="
|
79
70
|
- !ruby/object:Gem::Version
|
80
|
-
version: 0.
|
81
|
-
- - <
|
71
|
+
version: 0.14.0
|
72
|
+
- - "<"
|
82
73
|
- !ruby/object:Gem::Version
|
83
74
|
version: '2'
|
84
75
|
- !ruby/object:Gem::Dependency
|
85
76
|
name: twitter
|
86
77
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
78
|
requirements:
|
89
|
-
- - ~>
|
79
|
+
- - "~>"
|
90
80
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
81
|
+
version: '6.0'
|
92
82
|
type: :runtime
|
93
83
|
prerelease: false
|
94
84
|
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
85
|
requirements:
|
97
|
-
- - ~>
|
86
|
+
- - "~>"
|
98
87
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: string-scrub
|
102
|
-
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
|
-
requirements:
|
105
|
-
- - ! '>='
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
version: 0.0.3
|
108
|
-
- - <=
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.0.5
|
111
|
-
type: :runtime
|
112
|
-
prerelease: false
|
113
|
-
version_requirements: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ! '>='
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 0.0.3
|
119
|
-
- - <=
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version: 0.0.5
|
88
|
+
version: '6.0'
|
122
89
|
description:
|
123
90
|
email:
|
124
91
|
- y.ken.studio@gmail.com
|
@@ -126,16 +93,14 @@ executables: []
|
|
126
93
|
extensions: []
|
127
94
|
extra_rdoc_files: []
|
128
95
|
files:
|
129
|
-
- .gitignore
|
130
|
-
- .travis.yml
|
96
|
+
- ".gitignore"
|
97
|
+
- ".travis.yml"
|
131
98
|
- Appraisals
|
132
99
|
- Gemfile
|
133
100
|
- LICENSE.txt
|
134
101
|
- README.md
|
135
102
|
- Rakefile
|
136
103
|
- fluent-plugin-twitter.gemspec
|
137
|
-
- gemfiles/fluentd_v0.10.gemfile
|
138
|
-
- gemfiles/fluentd_v0.12.gemfile
|
139
104
|
- gemfiles/fluentd_v0.14.gemfile
|
140
105
|
- lib/fluent/plugin/in_twitter.rb
|
141
106
|
- lib/fluent/plugin/out_twitter.rb
|
@@ -145,27 +110,26 @@ files:
|
|
145
110
|
homepage: https://github.com/y-ken/fluent-plugin-twitter
|
146
111
|
licenses:
|
147
112
|
- Apache-2.0
|
113
|
+
metadata: {}
|
148
114
|
post_install_message:
|
149
115
|
rdoc_options: []
|
150
116
|
require_paths:
|
151
117
|
- lib
|
152
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
119
|
requirements:
|
155
|
-
- -
|
120
|
+
- - ">"
|
156
121
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
122
|
+
version: '2.1'
|
158
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
124
|
requirements:
|
161
|
-
- -
|
125
|
+
- - ">="
|
162
126
|
- !ruby/object:Gem::Version
|
163
127
|
version: '0'
|
164
128
|
requirements: []
|
165
129
|
rubyforge_project:
|
166
|
-
rubygems_version:
|
130
|
+
rubygems_version: 2.2.5
|
167
131
|
signing_key:
|
168
|
-
specification_version:
|
132
|
+
specification_version: 4
|
169
133
|
summary: Fluentd Input/Output plugin to collect/process tweets with Twitter Streaming
|
170
134
|
API.
|
171
135
|
test_files:
|