blinkman-twitter_search 0.1.0
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/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/blinkman-twitter_search.gemspec +24 -0
- data/lib/blinkman/adapter/twitter_search.rb +41 -0
- data/lib/blinkman/message/twitter_search.rb +10 -0
- data/lib/blinkman/twitter_search.rb +5 -0
- data/lib/blinkman/twitter_search/version.rb +5 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e09c3152e1d31cc86e223a02b8dd55162591a1f
|
4
|
+
data.tar.gz: 78278b8e10d1ac405697d09626613a98cac9f60c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 35e6aab0c7f143608d7ec56572d211a9a9bdf68c39cc91d9de9f0f04a696c00416edb87cafb4197d54461c9da427239ddec86b0be85fc812c4de43a97e3e855b
|
7
|
+
data.tar.gz: d86039c51029a495e6675b0edf62bda5d40a178ff7f3c61fe01ba0a659a1f3fdcc0a42dc5bacec4f0fb841eed2deb2195dce048e7a6c33759b76d5f7eaf167f6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 ru_shalm
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Blinkman::TwitterSearch
|
2
|
+
|
3
|
+
Twitter Search API adapter for [Blinkman](https://github.com/kinoppyd/blinkman)
|
4
|
+
|
5
|
+
## Require configuration
|
6
|
+
|
7
|
+
|ENV key|value|require|
|
8
|
+
|-------|-----|-------|
|
9
|
+
|TWITTER_CONSUMER_KEY|Twitter application key|yes|
|
10
|
+
|TWITTER_CONSUMER_SECRET|Twitter application secret|yes|
|
11
|
+
|TWITTER_ACCESS_TOKEN|Your Twitter access token|yes|
|
12
|
+
|TWITTER_ACCESS_TOKEN_SECRET|Your Twitter access token secret|yes|
|
13
|
+
|TWITTER_SEARCH_KEYWORD|Search keyword (ex. 'がんばるぞい OR 頑張るぞい')|yes|
|
14
|
+
|TWITTER_SEARCH_LANG|Search language (ex. ja)|no|
|
15
|
+
|TWITTER_SEARCH_WAIT_TIME|Search interval time. default 30 sec.|no|
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem 'blinkman'
|
23
|
+
gem 'blinkman-twitter_search'
|
24
|
+
```
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle install
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'blinkman'
|
34
|
+
|
35
|
+
bot = Blinkman::Bot.new do
|
36
|
+
blink green(2.times, during(250), when_if { |message|
|
37
|
+
puts message.body # => 今日も一日がんばるぞい!
|
38
|
+
true
|
39
|
+
})
|
40
|
+
end
|
41
|
+
|
42
|
+
bot.listen
|
43
|
+
```
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rutan/blinkman-twitter_search.
|
48
|
+
|
49
|
+
## License
|
50
|
+
MIT
|
51
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'blinkman/twitter_search/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'blinkman-twitter_search'
|
8
|
+
spec.version = Blinkman::TwitterSearch::VERSION
|
9
|
+
spec.authors = ['ru_shalm']
|
10
|
+
spec.email = ['ru_shalm@hazimu.com']
|
11
|
+
spec.summary = %q{Blinkman adapter for Twitter Search API.}
|
12
|
+
spec.homepage = 'https://github.com/rutan/blinkman-twitter_search'
|
13
|
+
spec.licenses = ['MIT']
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'blinkman'
|
21
|
+
spec.add_dependency 'mihatter'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'mihatter'
|
2
|
+
|
3
|
+
module Blinkman
|
4
|
+
module Adapter
|
5
|
+
class TwitterSearch < Base
|
6
|
+
include Configurable
|
7
|
+
|
8
|
+
configure 'twitter_consumer_key'
|
9
|
+
configure 'twitter_consumer_secret'
|
10
|
+
configure 'twitter_access_token'
|
11
|
+
configure 'twitter_access_token_secret'
|
12
|
+
|
13
|
+
configure 'twitter_search_keyword'
|
14
|
+
configure 'twitter_search_lang', optional: true
|
15
|
+
configure 'twitter_search_wait_time', optional: true
|
16
|
+
|
17
|
+
def listen
|
18
|
+
mihatter.run! do |tweet|
|
19
|
+
next unless tweet.retweeted_status.kind_of?(Twitter::NullObject)
|
20
|
+
message = Blinkman::Message::TwitterSearch.new(tweet)
|
21
|
+
bot.on_receive(message)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def mihatter
|
28
|
+
@mihatter ||= Mihatter::RestWatcher.new({
|
29
|
+
consumer_key: twitter_consumer_key,
|
30
|
+
consumer_secret: twitter_consumer_secret,
|
31
|
+
access_token: twitter_access_token,
|
32
|
+
access_token_secret: twitter_access_token_secret,
|
33
|
+
keyword: twitter_search_keyword,
|
34
|
+
lang: twitter_search_lang,
|
35
|
+
wait_time: (twitter_search_wait_time || 30).to_i,
|
36
|
+
})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blinkman-twitter_search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ru_shalm
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: blinkman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mihatter
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- ru_shalm@hazimu.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- blinkman-twitter_search.gemspec
|
82
|
+
- lib/blinkman/adapter/twitter_search.rb
|
83
|
+
- lib/blinkman/message/twitter_search.rb
|
84
|
+
- lib/blinkman/twitter_search.rb
|
85
|
+
- lib/blinkman/twitter_search/version.rb
|
86
|
+
homepage: https://github.com/rutan/blinkman-twitter_search
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.5.1
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Blinkman adapter for Twitter Search API.
|
110
|
+
test_files: []
|