fluent-plugin-json-api 0.0.1 → 0.0.2
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 +5 -0
- data/fluent-plugin-json-api.gemspec +4 -2
- data/lib/fluent/plugin/in_json_api.rb +2 -2
- data/test/plugin/in_json_api.rb +26 -24
- metadata +25 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30a72b58c1ff5553c7e6f037301bb9d0bf195c61
|
4
|
+
data.tar.gz: 3f2c15d87c7689d4055531eb024fa36cec1ec61f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11b3e86e2d577fed42ae3411344b0689aa08530d8583f698e71a609a9e0c2dd70e0c566b52dae4080a4e06de75829c5f00cdb067af824b6ea99944ca7fa346ec
|
7
|
+
data.tar.gz: 35eb1ee43efdc7a08e0dcd292dcc290413702575d4aa3558055e4ec4bc2c3a583ec62d32a5c7bbc6a3accbf5eadee1c7b73b2f2946d7d49db58921f5a1515fc4
|
data/.travis.yml
ADDED
@@ -3,10 +3,10 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-json-api"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.2"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Freddie Fujiwara"]
|
9
|
-
s.date = %q{2013-
|
9
|
+
s.date = %q{2013-10-14}
|
10
10
|
s.email = "github@ze.gs"
|
11
11
|
s.homepage = "http://github.com/freddiefujiwara/fluent-plugin-json-api"
|
12
12
|
s.summary = "json-api plugin for Fluentd"
|
@@ -17,4 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_dependency %q<fluentd>, ["~> 0.10.0"]
|
20
|
+
s.add_dependency %q<rake>, ["~> 0.9.6"]
|
21
|
+
s.license = 'MIT'
|
20
22
|
end
|
@@ -6,7 +6,7 @@ module Fluent
|
|
6
6
|
|
7
7
|
config_param :url, :string, :default => 'http://pipes.yahoo.com/pipes/pipe.run?_id=c9b9df32b4c3e0ccbe4547ae7e00ed2f&_render=json&condition=d7D&genre=100533&page=__PAGE__'
|
8
8
|
config_param :rules , :string
|
9
|
-
config_param :
|
9
|
+
config_param :run_interval , :integer, :default => 0
|
10
10
|
config_param :tag, :string
|
11
11
|
|
12
12
|
attr_reader :urls
|
@@ -56,7 +56,7 @@ module Fluent
|
|
56
56
|
loop {
|
57
57
|
@urls.each do |url|
|
58
58
|
Engine.emit @tag, Engine.now , crawl(url)
|
59
|
-
|
59
|
+
run_interval @run_interval if @run_interval.to_i > 0
|
60
60
|
end
|
61
61
|
}
|
62
62
|
end
|
data/test/plugin/in_json_api.rb
CHANGED
@@ -9,7 +9,7 @@ class FileInputTest < Test::Unit::TestCase
|
|
9
9
|
@d = create_driver %[
|
10
10
|
url http://pipes.yahoo.com/pipes/pipe.run?_id=c9b9df32b4c3e0ccbe4547ae7e00ed2f&_render=json&condition=d7D&genre=__GENRE__&page=__PAGE__
|
11
11
|
rules {'__PAGE__' => (1..10),'__GENRE__' => [1,100533]}
|
12
|
-
|
12
|
+
run_interval 1
|
13
13
|
tag input.json
|
14
14
|
]
|
15
15
|
@time = Time.now.to_i
|
@@ -22,34 +22,34 @@ class FileInputTest < Test::Unit::TestCase
|
|
22
22
|
def test_configure
|
23
23
|
assert_equal 'http://pipes.yahoo.com/pipes/pipe.run?_id=c9b9df32b4c3e0ccbe4547ae7e00ed2f&_render=json&condition=d7D&genre=__GENRE__&page=__PAGE__' , @d.instance.url
|
24
24
|
assert_equal @d.instance.rules.size, 20 #10(page) x 2(genre)
|
25
|
-
assert_equal 1 , @d.instance.
|
25
|
+
assert_equal 1 , @d.instance.run_interval
|
26
26
|
assert_equal 'input.json', @d.instance.tag
|
27
27
|
[ %[
|
28
28
|
url hoge
|
29
29
|
rules {'__PAGE__' => (1..10)}
|
30
|
-
|
30
|
+
run_interval 1
|
31
31
|
tag input.json
|
32
32
|
], #url wrong
|
33
33
|
%[
|
34
34
|
url ftp://hoge.com
|
35
35
|
rules {'__PAGE__' => (1..10)}
|
36
|
-
|
36
|
+
run_interval 1
|
37
37
|
tag input.json
|
38
38
|
], #url must start at http
|
39
39
|
%[
|
40
40
|
url http://hoge.com
|
41
|
-
|
41
|
+
run_interval 1
|
42
42
|
rules {'__PAGE__' => (1..10)}
|
43
43
|
], #no tag
|
44
44
|
%[
|
45
45
|
url http://hoge.com
|
46
|
-
|
46
|
+
run_interval 1
|
47
47
|
rules {__PAGE__}
|
48
48
|
tag input.json
|
49
49
|
], #rules must be {'key' => array}
|
50
50
|
%[
|
51
51
|
url http://hoge.com
|
52
|
-
|
52
|
+
run_interval 1
|
53
53
|
rules (1..2)
|
54
54
|
tag input.json
|
55
55
|
], #rules must be {'key' => array}
|
@@ -77,23 +77,25 @@ class FileInputTest < Test::Unit::TestCase
|
|
77
77
|
url = "http://pipes.yahoo.com/pipes/pipe.run?_id=c9b9df32b4c3e0ccbe4547ae7e00ed2f&_render=json&condition=d7D&genre=100533&page=#{page}"
|
78
78
|
response = @d.instance.crawl url
|
79
79
|
assert_not_nil response
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
80
|
+
if response['count'].to_i > 0
|
81
|
+
assert_equal response['count'], 30
|
82
|
+
assert_equal response['value']['items'].size, 30
|
83
|
+
response['value']['items'].each do |item|
|
84
|
+
#content
|
85
|
+
assert item['author']['content'].to_f >= 0.0
|
86
|
+
assert item['author']['content'].to_f <= 5.0
|
87
|
+
|
88
|
+
#link
|
89
|
+
assert_equal URI.parse(item['link']).scheme, 'http' if item['link']
|
90
|
+
#title
|
91
|
+
assert_equal URI.parse(item['title']).scheme, 'http' if item['title']
|
92
|
+
|
93
|
+
#description
|
94
|
+
assert_not_nil item['description']
|
95
|
+
|
96
|
+
#pubDate
|
97
|
+
assert_not_nil item['pubDate']['content']
|
98
|
+
end
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
metadata
CHANGED
@@ -1,36 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-json-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Freddie Fujiwara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.10.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.10.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.6
|
27
41
|
description:
|
28
42
|
email: github@ze.gs
|
29
43
|
executables: []
|
30
44
|
extensions: []
|
31
45
|
extra_rdoc_files: []
|
32
46
|
files:
|
33
|
-
-
|
47
|
+
- .gitignore
|
48
|
+
- .travis.yml
|
34
49
|
- Gemfile
|
35
50
|
- LICENSE
|
36
51
|
- README.md
|
@@ -39,7 +54,8 @@ files:
|
|
39
54
|
- lib/fluent/plugin/in_json_api.rb
|
40
55
|
- test/plugin/in_json_api.rb
|
41
56
|
homepage: http://github.com/freddiefujiwara/fluent-plugin-json-api
|
42
|
-
licenses:
|
57
|
+
licenses:
|
58
|
+
- MIT
|
43
59
|
metadata: {}
|
44
60
|
post_install_message:
|
45
61
|
rdoc_options: []
|
@@ -47,17 +63,17 @@ require_paths:
|
|
47
63
|
- lib
|
48
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
65
|
requirements:
|
50
|
-
- -
|
66
|
+
- - '>='
|
51
67
|
- !ruby/object:Gem::Version
|
52
68
|
version: '0'
|
53
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
70
|
requirements:
|
55
|
-
- -
|
71
|
+
- - '>='
|
56
72
|
- !ruby/object:Gem::Version
|
57
73
|
version: '0'
|
58
74
|
requirements: []
|
59
75
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.0.
|
76
|
+
rubygems_version: 2.0.3
|
61
77
|
signing_key:
|
62
78
|
specification_version: 4
|
63
79
|
summary: json-api plugin for Fluentd
|