tw 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/tw.rb +0 -1
- data/lib/tw/client/stream.rb +12 -14
- data/lib/tw/version.rb +1 -1
- data/tw.gemspec +1 -1
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cbca5d6d9424b6bc4b14c75b1b0516c133a6c1b
|
4
|
+
data.tar.gz: a30d27fc896def18a7d7bfb419c8849836d65f8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b60705bad682626dafa97d50241b68c4bd19826776e9df556b8443d1e08480ffe7514056280422134cfd3c22ea1bfe7c9d96f31644fe456dcc95fabbe1d66212
|
7
|
+
data.tar.gz: 3fc301af0cde6adaaa0142bae1138114ccd968741b3316d0970805bfac3377d85dc4a1897b61fe9f551f78923fa60b29c10014b312a8b344f2cb24e067d18326
|
data/History.txt
CHANGED
data/lib/tw.rb
CHANGED
data/lib/tw/client/stream.rb
CHANGED
@@ -3,41 +3,39 @@ module Tw
|
|
3
3
|
class Client::Stream
|
4
4
|
def initialize(user=nil)
|
5
5
|
user = Tw::Auth.get_or_regist_user user
|
6
|
-
|
6
|
+
@client = Twitter::Streaming::Client.new do |config|
|
7
7
|
config.consumer_key = Conf['consumer_key']
|
8
8
|
config.consumer_secret = Conf['consumer_secret']
|
9
|
-
config.
|
10
|
-
config.
|
9
|
+
config.access_token = user['access_token']
|
10
|
+
config.access_token_secret = user['access_secret']
|
11
11
|
end
|
12
|
-
|
13
|
-
@client = UserStream::Client.new
|
14
12
|
end
|
15
13
|
|
16
14
|
def user_stream(&block)
|
17
15
|
raise ArgumentError, 'block not given' unless block_given?
|
18
|
-
@client.user do |
|
19
|
-
if
|
20
|
-
yield
|
16
|
+
@client.user do |chunk|
|
17
|
+
if tweet = get_if_tweet(chunk)
|
18
|
+
yield tweet
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
23
|
def filter(*track_words, &block)
|
26
24
|
raise ArgumentError, 'block not given' unless block_given?
|
27
|
-
@client.filter :track => track_words.join(',') do |
|
28
|
-
if
|
29
|
-
yield
|
25
|
+
@client.filter :track => track_words.join(',') do |chunk|
|
26
|
+
if tweet = get_if_tweet(chunk)
|
27
|
+
yield tweet
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
32
|
private
|
35
|
-
def
|
36
|
-
return
|
33
|
+
def get_if_tweet(chunk)
|
34
|
+
return nil unless chunk.kind_of? Twitter::Tweet
|
37
35
|
Tw::Tweet.new(:id => chunk.id,
|
38
36
|
:user => chunk.user.screen_name,
|
39
37
|
:text => chunk.text,
|
40
|
-
:time =>
|
38
|
+
:time => chunk.created_at)
|
41
39
|
end
|
42
40
|
|
43
41
|
end
|
data/lib/tw/version.rb
CHANGED
data/tw.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency 'twitter', '>= 5.15.0'
|
21
|
-
gem.add_dependency '
|
21
|
+
gem.add_dependency 'oauth', '>= 0.5.3'
|
22
22
|
gem.add_dependency 'json', '>= 2.1.0'
|
23
23
|
gem.add_dependency 'yajl-ruby', '>= 1.3.0'
|
24
24
|
gem.add_dependency 'rainbow', '>= 2.2.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|
@@ -25,25 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: oauth
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 1.3.0
|
33
|
+
version: 0.5.3
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 1.3.0
|
40
|
+
version: 0.5.3
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: json
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|