statement 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a8ae6bc7ccdba1e7b0a9386783850c17087d271
4
- data.tar.gz: b4866d9e6aa21842e80fbddf4976c3c9f40e7977
3
+ metadata.gz: 88a5cc8cc4a20b541a5cadd65e4ab3c139f5cf9f
4
+ data.tar.gz: 37d62f7c98c3a92b09980c14a5dde0d3c2c809ba
5
5
  SHA512:
6
- metadata.gz: 7b76d809d6016d596c97676d74105f2a808ada79f50a1ff8d5c0eba2776430125a9c0eba2a06f3c10514d756efb6a2049ebaf7e9ce0769bbf418b7e339c5125e
7
- data.tar.gz: d2a535998e0107b8b3d904d2616d85a8a7d3312bb3a13e0877b5f3f821986ac64d38643b363d5745b9e2031b6c62aa8ea0ccfbfa0f8026b4cf2233447d72aea2
6
+ metadata.gz: 4ac80b83893c08c95d6d8a3623ca6a0859cddbfdba8e00004a8ff8370c6f87bc393d059f900eb60484993a70ea0a363a1033305d68a883fd4fe8fa61dbf27755
7
+ data.tar.gz: b95a2cba9cd02eb533d4fe73b681c180eb23d28eeb52491174548c59df794667b8fd194397699426cfc94918a32813de297789bedf62c8256b38e6b9196f05ca
@@ -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(client.user_timeline(member_id))
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(client.list_timeline(list_owner, list_id, {:count => 100}))
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[: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]}
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
@@ -1,3 +1,3 @@
1
1
  module Statement
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statement
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Willis