statement 2.0.2 → 2.0.3
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/lib/statement/tweets.rb +10 -10
- data/lib/statement/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88a5cc8cc4a20b541a5cadd65e4ab3c139f5cf9f
|
4
|
+
data.tar.gz: 37d62f7c98c3a92b09980c14a5dde0d3c2c809ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ac80b83893c08c95d6d8a3623ca6a0859cddbfdba8e00004a8ff8370c6f87bc393d059f900eb60484993a70ea0a363a1033305d68a883fd4fe8fa61dbf27755
|
7
|
+
data.tar.gz: b95a2cba9cd02eb533d4fe73b681c180eb23d28eeb52491174548c59df794667b8fd194397699426cfc94918a32813de297789bedf62c8256b38e6b9196f05ca
|
data/lib/statement/tweets.rb
CHANGED
@@ -2,9 +2,9 @@ require 'twitter'
|
|
2
2
|
|
3
3
|
module Statement
|
4
4
|
class Tweets
|
5
|
-
|
5
|
+
|
6
6
|
attr_accessor :client, :rest_client, :timeline, :bulk_timeline
|
7
|
-
|
7
|
+
|
8
8
|
def initialize
|
9
9
|
@@config = Statement.config rescue nil || {}
|
10
10
|
@client = Twitter::Client.new(
|
@@ -20,10 +20,10 @@ module Statement
|
|
20
20
|
:oauth_token_secret => @@config[:oauth_token_secret] || ENV['OAUTH_TOKEN_SECRET']
|
21
21
|
)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
# fetches single twitter user's timeline
|
25
25
|
def timeline(member_id)
|
26
|
-
process_results(
|
26
|
+
process_results(rest_client.user_timeline(member_id))
|
27
27
|
end
|
28
28
|
|
29
29
|
# batch lookup of users, 100 at a time
|
@@ -34,20 +34,20 @@ module Statement
|
|
34
34
|
end
|
35
35
|
results.flatten
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# fetches latest 100 tweets from a list (derekwillis twitter acct has a public congress list)
|
39
39
|
def bulk_timeline(list_id, list_owner=nil)
|
40
|
-
process_results(
|
40
|
+
process_results(rest_client.list_timeline(list_owner, list_id, {:count => 100}))
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def process_results(tweets)
|
44
44
|
results = []
|
45
45
|
tweets.each do |tweet|
|
46
|
-
url = tweet
|
47
|
-
results << { :id => tweet
|
46
|
+
url = tweet.urls.first ? tweet.urls.first.expanded_url : nil
|
47
|
+
results << { :id => tweet.id, :body => tweet.text, :link => url, :in_reply_to_screen_name => tweet.in_reply_to_screen_name, :total_tweets => tweet.user.statuses_count, :created_time => tweet.created_at, :retweets => tweet.retweet_count, :favorites => tweet.favorite_count, :screen_name => tweet.user.screen_name}
|
48
48
|
end
|
49
49
|
results
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
53
|
-
end
|
53
|
+
end
|
data/lib/statement/version.rb
CHANGED