pork_sandwich 0.4.16 → 0.4.17
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.
- data/README +173 -12
- data/VERSION +1 -1
- data/lib/pork_sandwich/log.rb +3 -3
- data/lib/pork_sandwich/puller.rb +41 -17
- data/lib/pork_sandwich/search.rb +2 -1
- data/test/fakewebs.rb +51 -28
- data/test/log_test.rb +2 -2
- data/test/puller_test.rb +79 -24
- metadata +3 -3
data/README
CHANGED
@@ -1,21 +1,182 @@
|
|
1
1
|
--README--
|
2
2
|
|
3
|
-
|
3
|
+
Integrating pork_sandwich into your rails project:
|
4
|
+
|
5
|
+
|
6
|
+
1. Drop this into config/environment.rb (after the Rails::Initializer.run do |config| line, but before the "end" statement of that block):
|
7
|
+
|
8
|
+
config.gem "pork_sandwich", :version => ">=0.4.17"
|
9
|
+
|
10
|
+
3. Make sure pork_sandwich is installed by running:
|
11
|
+
|
12
|
+
rake gems:install
|
13
|
+
|
14
|
+
4. create the pork_sandwich models:
|
15
|
+
|
16
|
+
script/generate pork_sandwich_models
|
17
|
+
|
18
|
+
5. create the pork_sandwich db migration:
|
19
|
+
|
20
|
+
script/generate pork_sandwich_migration
|
21
|
+
|
22
|
+
6. run:
|
23
|
+
|
24
|
+
rake db:migrate
|
25
|
+
|
26
|
+
Pork Classes and Database Objects can now be referenced throughout your project. Happy porking.
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
___________________________________________
|
31
|
+
|
32
|
+
|
33
|
+
Class: Search
|
34
|
+
Used for collecting and storing tweets that match a given search term
|
35
|
+
|
36
|
+
Search moves backwards through twitter's search API, asking twitter for tweets from most recent to oldest. Without other stop conditions set, an historical pull will continue until the method collects all that is currently available from Twitter. Twitter's search API makes available tweets created as long as ~6 days ago.
|
37
|
+
|
38
|
+
Pork::Search.new(query, {options})
|
39
|
+
|
40
|
+
query: a string representing the search you want to run. One or more words separated by spaces will be treated as AND terms, not as a phrase. Putting a - before a word will search for tweets that do not contain that word. Terms are case insensitive.
|
41
|
+
|
42
|
+
:desired_count => specifies the number of tweets to collect, written as an integer, provided that that many tweets available from Twitter.
|
43
|
+
:since_id => specifies the tweet status_id, written as an integer, at which to stop collecting
|
44
|
+
:from_user => specifies the username (as string) or user_id (as integer) of a twitter user who's timeline you would like to search
|
45
|
+
:pulls_per_hour => specifies the rate at which to make API calls. Default = 1500, which is recommended for non-whitelisted IPs
|
46
|
+
|
47
|
+
|
48
|
+
Methods:
|
49
|
+
|
50
|
+
.historical_pull
|
51
|
+
|
52
|
+
Executes a search based on the search parameters specified by Search instance. Returns true when complete.
|
53
|
+
|
54
|
+
.current_count
|
55
|
+
|
56
|
+
returns the number of tweets collected thus far
|
57
|
+
|
58
|
+
.desired_count
|
59
|
+
|
60
|
+
read or set the desired count
|
61
|
+
|
62
|
+
.from_user
|
63
|
+
|
64
|
+
read or set the from user
|
65
|
+
|
66
|
+
.since_id
|
67
|
+
|
68
|
+
read or set the status id at which to stop collecting
|
69
|
+
|
70
|
+
.pulls_per_hour
|
71
|
+
|
72
|
+
read or set number of pulls per hour
|
73
|
+
|
74
|
+
.db_ids_created
|
75
|
+
|
76
|
+
returns an array of the database id numbers of the tweets that have been saved into the database by this search.
|
77
|
+
|
78
|
+
Examples:
|
79
|
+
|
80
|
+
# Pulls all tweets from twitter's search API that mention pork:
|
81
|
+
search = Pork::Search.new('pork')
|
82
|
+
search.historical_pull
|
83
|
+
|
84
|
+
# Pull all tweets with a status id higher than 950463847 from twitter's search API that mention smokey AND tender:
|
85
|
+
search = Pork::Search.new('smokey+tender')
|
86
|
+
search.since_id = 950463847
|
87
|
+
search.historical_pull
|
88
|
+
|
89
|
+
# Pull up to 150 tweets created by user 'sam1vp' from twitter's search API that mention 'bbq':
|
90
|
+
search = Pork::Search.new('bbq', {:from_user => 'sam1vp', :desired_count => 150})
|
91
|
+
search.historical_pull
|
92
|
+
|
93
|
+
|
94
|
+
___________________________________________
|
95
|
+
|
96
|
+
Class: TwitterUser
|
97
|
+
Used for collecting data about a given twitter user
|
98
|
+
|
99
|
+
TwitterUser.new({options})
|
100
|
+
|
101
|
+
:twitter_id => status id of the user you wish to gather info about
|
102
|
+
:twitter_screen_name => string of the screen name of the user you wish to gather info about
|
103
|
+
:desired_follower_count => max number of followers you want to pull and save
|
104
|
+
:desired_friend_count => max number of friends you want to pull and save
|
105
|
+
:since_tweet_id => tweet status id at which to stop collecting this user's tweets
|
106
|
+
|
107
|
+
|
108
|
+
Methods:
|
109
|
+
|
110
|
+
.pull_tweets
|
111
|
+
|
112
|
+
pulls and stores tweets from a user's timeline. If no stop conditions have been set, this will pull as many tweets as twitter makes available, usually up to ~2000 tweets.
|
113
|
+
|
114
|
+
.pull_account_info
|
115
|
+
|
116
|
+
pulls and stores this user's account info only if it's not already in the database.
|
117
|
+
|
118
|
+
.update_account_info
|
119
|
+
|
120
|
+
pulls and stores this user's account info, overwriting any existing info in the database
|
121
|
+
|
122
|
+
.pull_friends
|
123
|
+
|
124
|
+
pulls and stores account info for 100 friends per call, cursoring through a user's friends until a desired count has been reached or all friends have been pulled. This method also stores a row in the twitter_relationships table for each friend.
|
125
|
+
|
126
|
+
.pull_followers
|
127
|
+
|
128
|
+
pulls and stores account info for 100 followers per call, cursoring through a user's followers until a desired count has been reached or all followers have been pulled. This method also stores a row in the twitter_relationships table for each follower.
|
129
|
+
|
130
|
+
.pull_friend_ids
|
131
|
+
|
132
|
+
pulls an array of all the ids of this user's friends in one call, creating 'shell' rows in the twitter_accounts table and rows in the twitter_relationships table. Ideal for quickly harvesting relationship data.
|
133
|
+
|
134
|
+
.pull_follower_ids
|
135
|
+
|
136
|
+
pulls an array of all the ids of this user's followers in one call, creating 'shell' rows in the twitter_accounts table and rows in the twitter_relationships table. Ideal for quickly harvesting relationship data.
|
137
|
+
|
138
|
+
___________________________________________
|
139
|
+
|
140
|
+
Class: Saver
|
141
|
+
|
142
|
+
Saver, which handles database insertions, is automatically instantiated when needed and referenced by $SAVER. You only need to interact with it if you want to tag tweets, account data, or relationship data via the acts_as_taggable activerecord extension. To tag data stored by a given Search or TwitterUser instance, after creating that instance, write:
|
143
|
+
|
144
|
+
$Saver.rules = {'tags' => {'tag' => foo, 'tag' => bar}}
|
145
|
+
|
146
|
+
___________________________________________
|
147
|
+
|
148
|
+
Class: Log
|
149
|
+
|
150
|
+
Search and TwitterUser are designed to output both standard and error handling messages to a log file to help document the data collection process. In order to take advantage of these logging features, you must create a globally accessible logger:
|
151
|
+
|
152
|
+
$PORK_LOG = Pork::Log.new(log [, options])
|
153
|
+
|
154
|
+
log: the place to which logger should write. accepts STDOUT, STDERR, or a string specifying the relative path of a log file, which will be either created or updated.
|
155
|
+
|
156
|
+
options
|
157
|
+
:researcher => appends a researcher name to the start of any log message
|
158
|
+
:project => appends a project name to the start of any log message
|
159
|
+
|
160
|
+
|
161
|
+
Methods:
|
162
|
+
|
163
|
+
.write(string)
|
164
|
+
|
165
|
+
use this method on $PORK_LOG to add your own messages to the log
|
166
|
+
|
167
|
+
___________________________________________
|
168
|
+
|
169
|
+
Expected Changes:
|
170
|
+
|
171
|
+
- A reaction processor, which can be used to search for and store tweets that either mention, reply to, retweet, or are mentioned by, replied by, or retweeted by a given user
|
172
|
+
- New database structures and methods for tracking search terms or user_timelines over time
|
173
|
+
- New database structures and methods for 'crawling,' i.e. traversing the twitter relationship graph. This will make it possible to do things like pull all tweets from a user, his followers, and his follower's followers.
|
174
|
+
- Optional batch insertion, which will greatly speed up the rate at which data is stored. This will likely limit the gem to projects that user either MySQL or Postgres, and may preclude the use of various active_record association methods.
|
175
|
+
|
4
176
|
|
5
|
-
1. Create a new rails project
|
6
177
|
|
7
|
-
2. Drop this into config/environment.rb (after the Rails::Initializer.run do |config| line, but before the "end" statement of that block)
|
8
|
-
config.gem "pork_sandwich", :version => ">=0.4.5"
|
9
178
|
|
10
|
-
3. rake gems:install
|
11
|
-
or
|
12
|
-
sudo rake gems:install
|
13
179
|
|
14
|
-
4. script/generate pork_sandwich_models
|
15
180
|
|
16
|
-
5. script/generate pork_sandwich_migration
|
17
181
|
|
18
|
-
6. rake db:migrate
|
19
|
-
(may have to comment the "with timestamp" stuff out in the migration. Starts with "begin" and has a lot of execute statements in it.)
|
20
182
|
|
21
|
-
Pork Classes and db Objects can now be referenced throughout your project. Happy porking.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.17
|
data/lib/pork_sandwich/log.rb
CHANGED
@@ -5,12 +5,12 @@ module Pork
|
|
5
5
|
def initialize(output, options = {})
|
6
6
|
@log = Logger.new(output)
|
7
7
|
@log.level = Logger::INFO
|
8
|
-
@researcher = options[:researcher]? options[:researcher] :
|
9
|
-
@project = options[:project]? options[:project] :
|
8
|
+
@researcher = options[:researcher]? options[:researcher] : nil
|
9
|
+
@project = options[:project]? options[:project] : nil
|
10
10
|
end
|
11
11
|
|
12
12
|
def write(message)
|
13
|
-
@log.info("#{@project
|
13
|
+
@log.info("#{@project ? @project + ', ' : ''}#{@researcher ? @researcher + ', ' : ''}#{Time.now.to_s} -- " + message)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/pork_sandwich/puller.rb
CHANGED
@@ -3,20 +3,22 @@ module Pork
|
|
3
3
|
attr_accessor :auth_object
|
4
4
|
|
5
5
|
def initialize(auth_object = nil)
|
6
|
-
@auth_object = auth_object.auth
|
6
|
+
@auth_object = auth_object ? auth_object.auth : auth_object
|
7
7
|
end
|
8
8
|
|
9
9
|
def pull(user_object, &pull_type)
|
10
|
-
|
10
|
+
@user = user_object
|
11
11
|
begin
|
12
12
|
pull_type.call(@user, @auth_object)
|
13
|
-
|
13
|
+
rescue Errno::ECONNRESET
|
14
|
+
p "ERROR: Connection reset by peer, probably because you tried to access an unauthorized page. Moving on."
|
14
15
|
rescue Twitter::Unavailable
|
15
16
|
p "ERROR: Twitter unavailable, trying in 60"
|
16
17
|
sleep 60
|
17
18
|
retry
|
18
19
|
rescue Twitter::NotFound
|
19
20
|
p "ERROR: Info target not found, trying to skip"
|
21
|
+
# rescue Twitter::Unauthorized
|
20
22
|
# rescue Crack::ParseError
|
21
23
|
# raise Crack::ParseError
|
22
24
|
rescue Errno::ETIMEDOUT
|
@@ -36,7 +38,7 @@ end
|
|
36
38
|
|
37
39
|
|
38
40
|
ACCOUNT_INFO = lambda do |user_object, auth_object|
|
39
|
-
@pull_data = Twitter.user(user_object.search)
|
41
|
+
@pull_data = auth_object ? auth_object.user(user_object.search) : Twitter.user(user_object.search)
|
40
42
|
{:pull_data => @pull_data, :db_object => $SAVER.save(@pull_data, &TWITTER_ACCOUNT_SAVE)}
|
41
43
|
end
|
42
44
|
|
@@ -49,7 +51,14 @@ FOLLOWERS = lambda do |user, auth_object|
|
|
49
51
|
# end
|
50
52
|
loop do
|
51
53
|
rules[:cursor] = -1 if !rules[:cursor]
|
52
|
-
|
54
|
+
if auth_object
|
55
|
+
@pull_data = auth_object.followers(rules)
|
56
|
+
else
|
57
|
+
@url = "http://twitter.com/statuses/followers.json?"
|
58
|
+
rules.each {|k,v| @url << URI.escape("#{k.to_s}=#{v.to_s}&")}
|
59
|
+
@url.chop!
|
60
|
+
@pull_data = Hashie::Mash.new(JSON.parse(Net::HTTP.get(URI.parse(@url))))
|
61
|
+
end
|
53
62
|
@pull_data.users.each do |follower_mash|
|
54
63
|
db_user_object = $SAVER.save(follower_mash, &TWITTER_ACCOUNT_SAVE)
|
55
64
|
follower_relationship_db_ids << $SAVER.save({:friend => user, :follower => Pork::TwitterUser.new(:twitter_id => follower_mash.id, :twitter_screen_name => follower_mash.screen_name, :db_object => db_user_object)}, &RELATIONSHIP_SAVE).id
|
@@ -65,10 +74,9 @@ end
|
|
65
74
|
|
66
75
|
FOLLOWER_IDS = lambda do |user, auth_object|
|
67
76
|
user.pull_account_info
|
68
|
-
# rules[:user_id] = user.twitter_id
|
69
77
|
$SAVER.rules[:complete_follower_set] = true
|
70
78
|
follower_relationship_db_ids = []
|
71
|
-
@pull_data = auth_object.follower_ids({:user_id => user.twitter_id})
|
79
|
+
@pull_data = auth_object ? auth_object.follower_ids({:user_id => user.twitter_id}) : Twitter.follower_ids(user.twitter_id)
|
72
80
|
@pull_data.each do |user_id|
|
73
81
|
db_user_object = $SAVER.save(Pork::TwitterUser.new(:twitter_id => user_id), &TWITTER_ACCOUNT_SAVE)
|
74
82
|
follower_relationship_db_ids << $SAVER.save({:friend => user,
|
@@ -89,7 +97,14 @@ FRIENDS = lambda do |user, auth_object|
|
|
89
97
|
# end
|
90
98
|
loop do
|
91
99
|
rules[:cursor] = -1 if !rules[:cursor]
|
92
|
-
|
100
|
+
if auth_object
|
101
|
+
@pull_data = auth_object.friends(rules)
|
102
|
+
else
|
103
|
+
@url = "http://twitter.com/statuses/friends.json?"
|
104
|
+
rules.each {|k,v| @url << URI.escape("#{k.to_s}=#{v.to_s}&")}
|
105
|
+
@url.chop!
|
106
|
+
@pull_data = Hashie::Mash.new(JSON.parse(Net::HTTP.get(URI.parse(@url))))
|
107
|
+
end
|
93
108
|
@pull_data.users.each do |friend_mash|
|
94
109
|
db_user_object = $SAVER.save(friend_mash, &TWITTER_ACCOUNT_SAVE)
|
95
110
|
friend_relationship_db_ids << $SAVER.save({:friend => Pork::TwitterUser.new(:twitter_id => friend_mash.id, :twitter_screen_name => friend_mash.screen_name, :db_object => db_user_object), :follower => user}, &RELATIONSHIP_SAVE).id
|
@@ -105,10 +120,9 @@ end
|
|
105
120
|
|
106
121
|
FRIEND_IDS = lambda do |user, auth_object|
|
107
122
|
user.pull_account_info
|
108
|
-
# rules[:user_id] = user.twitter_id
|
109
123
|
$SAVER.rules[:complete_friend_set] = true
|
110
124
|
friend_relationship_db_ids = []
|
111
|
-
@pull_data = auth_object.friend_ids({:user_id => user.twitter_id})
|
125
|
+
@pull_data = auth_object ? auth_object.friend_ids({:user_id => user.twitter_id}) : Twitter.friend_ids(user.twitter_id)
|
112
126
|
@pull_data.each do |user_id|
|
113
127
|
db_user_object = $SAVER.save(Pork::TwitterUser.new(:twitter_id => user_id), &TWITTER_ACCOUNT_SAVE)
|
114
128
|
friend_relationship_db_ids << $SAVER.save({:follower => user, :friend => Pork::TwitterUser.new(:twitter_id => user_id, :db_object => db_user_object)}, &RELATIONSHIP_SAVE)
|
@@ -120,17 +134,27 @@ end
|
|
120
134
|
TWEETS = lambda do |user, auth_object|
|
121
135
|
rules = {:count => 200}
|
122
136
|
if user.twitter_id
|
123
|
-
|
137
|
+
@id = user.twitter_id
|
138
|
+
@id_hash = {"user_id" => @id}
|
124
139
|
else
|
125
|
-
|
140
|
+
@id = user.screen_name
|
141
|
+
@id_hash = {"screen_name" => @id}
|
126
142
|
end
|
127
143
|
@tweet_db_ids = []
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
144
|
+
loop do
|
145
|
+
@pull_data = auth_object ? auth_object.user_timeline(rules.merge(@id_hash)) : Twitter.timeline(@id,rules)
|
146
|
+
@pull_data.each do |result|
|
147
|
+
if (user.since_tweet_id ? @pull_data.last.id <= user.since_tweet_id : false)
|
148
|
+
break
|
149
|
+
else
|
150
|
+
@tweet_db_ids << $SAVER.save(result, &USER_TWEET_SAVE).id
|
151
|
+
end
|
152
|
+
end
|
153
|
+
if @pull_data.last.id == rules[:max_id] or (user.since_tweet_id ? @pull_data.last.id <= user.since_tweet_id : false )
|
154
|
+
break
|
155
|
+
else
|
156
|
+
rules[:max_id] = @pull_data.last.id
|
132
157
|
end
|
133
|
-
@tweet_db_ids << $SAVER.save(result, &USER_TWEET_SAVE).id
|
134
158
|
end
|
135
159
|
# rules[:reactions] ? $REACTION_PROCESSOR.process_reactions(@tweet_db_objects) : nil
|
136
160
|
{:db_ids => @tweet_db_ids}
|
data/lib/pork_sandwich/search.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Pork
|
2
2
|
class Search
|
3
|
+
attr_accessor :desired_count, :from_user, :since_id, :pulls_per_hour
|
3
4
|
attr_reader :query, :db_ids_created, :desired_count, :from_user, :current_count
|
4
5
|
|
5
6
|
def initialize(query, options = {})
|
@@ -10,7 +11,7 @@ module Pork
|
|
10
11
|
@from_user = options[:from_user]
|
11
12
|
@db_ids_created = []
|
12
13
|
@collect_users = options[:collect_users]
|
13
|
-
@pulls_per_hour = options[:pulls_per_hour]? options[:pulls_per_hour] :
|
14
|
+
@pulls_per_hour = options[:pulls_per_hour]? options[:pulls_per_hour] : 1500
|
14
15
|
end
|
15
16
|
|
16
17
|
def historical_pull
|
data/test/fakewebs.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
config = YAML::load(File.open("#{File.dirname(__FILE__)}/../config/pork_config.yml"))
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
http_auth_string = config['config']['twitter_auth']['username'] + ":" + config['config']['twitter_auth']['password'] + "@"
|
4
|
+
auth_and_no_auth = [http_auth_string, ""]
|
5
|
+
|
4
6
|
|
5
7
|
FakeWeb.allow_net_connect = false
|
6
8
|
|
@@ -11,56 +13,77 @@ FakeWeb.register_uri(:any, "http://search.twitter.com/search.json?max_id=5624809
|
|
11
13
|
|
12
14
|
FakeWeb.register_uri(:any, "http://search.twitter.com/search.json?max_id=5555&rpp=100&q=test", :body => '{"results":[{"profile_image_url":"http://a3.twimg.com/profile_images/56115537/Andrew_-_small_normal.jpg","created_at":"Wed, 11 Nov 2009 17:52:09 +0000","from_user":"LucasIsCheap","to_user_id":null,"text":"Gearing up yo fail this calculus III test. Wish me luck!","id":5555,"from_user_id":842449,"geo":null,"iso_language_code":"en","source":"<a href="http://help.twitter.com/index.php?pg=kb.page&id=75" rel="nofollow">txt</a>"}],"max_id":5624810553,"since_id":0,"refresh_url":"?since_id=5624810553&q=test","next_page":"?page=2&max_id=5624810553&q=test","results_per_page":15,"page":1,"completed_in":0.040758,"query":"test"}')
|
13
15
|
|
14
|
-
|
16
|
+
auth_and_no_auth.each do |auth_string|
|
15
17
|
# USER INFO METHOD
|
16
|
-
FakeWeb.register_uri(:any, "http://#{
|
17
|
-
|
18
|
-
# FOLLLOWER IDS METHOD
|
19
|
-
FakeWeb.register_uri(:any, "http://#{username}:#{password}@twitter.com/followers/ids.json?user_id=15019521", :body => '[55555,4444,15019521]')
|
18
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/users/show/15019521.json", :body => '{"following":false,"statuses_count":260,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","status":{"in_reply_to_screen_name":null,"source":"web","created_at":"Tue Nov 10 15:22:43 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"},"geo_enabled":false,"profile_background_tile":false,"profile_background_color":"EDECE9","url":null,"verified":false,"profile_sidebar_fill_color":"E3E2DE","followers_count":132,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","friends_count":133,"profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","location":"Cambridge, MA","name":"Sam Gilbert","notifications":false,"favourites_count":0,"screen_name":"sam1vp","id":15019521,"utc_offset":-18000,"profile_text_color":"634047"}')
|
20
19
|
|
21
|
-
FakeWeb.register_uri(:any, "http://#{username}:#{password}@twitter.com/followers/ids.json?user_id=55555", :body => '[4444]')
|
22
20
|
|
23
|
-
FakeWeb.register_uri(:any, "http://#{username}:#{password}@twitter.com/followers/ids.json?user_id=4444", :body => '[333, 22, 1]')
|
24
21
|
|
25
22
|
# FOLLOWERS USER INFO METHOD
|
26
|
-
FakeWeb.register_uri(:any, "http://#{
|
23
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=-1&user_id=15019521", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":55555,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"},{"following":false,"geo_enabled":false,"statuses_count":114,"description":"Atlantic senior editor, James Beard Award-winner, and curator of The Atlantic Food Channel.","profile_image_url":"http://a1.twimg.com/profile_images/130071282/corby_mug_yellow_normal.png","status":{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_screen_name":null,"source":"<a href=\"http://twitterfeed.com\" rel=\"nofollow\">twitterfeed</a>","created_at":"Mon Nov 09 16:51:45 +0000 2009","id":5562998741,"text":"LAST OF THE ROMANOS My favorite green beans are at end-of-season farmers markets. Try them with this secret sa.. http://bit.ly/10jqzl"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":4444,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":55555, "previous_cursor":0 }')
|
24
|
+
|
25
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=55555&user_id=15019521", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"},{"following":false,"geo_enabled":false,"statuses_count":114,"description":"Atlantic senior editor, James Beard Award-winner, and curator of The Atlantic Food Channel.","profile_image_url":"http://a1.twimg.com/profile_images/130071282/corby_mug_yellow_normal.png","status":{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_screen_name":null,"source":"<a href=\"http://twitterfeed.com\" rel=\"nofollow\">twitterfeed</a>","created_at":"Mon Nov 09 16:51:45 +0000 2009","id":5562998741,"text":"LAST OF THE ROMANOS My favorite green beans are at end-of-season farmers markets. Try them with this secret sa.. http://bit.ly/10jqzl"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":22,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
26
|
+
|
27
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=-1&user_id=55555", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
28
|
+
|
29
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=-1&user_id=4444", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
30
|
+
|
31
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=-1&user_id=333", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
32
|
+
|
33
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/followers.json?cursor=-1&user_id=22", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":1,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
27
34
|
|
28
|
-
|
35
|
+
# FRIEND USER INFO METHOD
|
36
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=-1&user_id=15019521", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing0","id":55555,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"},{"following":false,"geo_enabled":false,"statuses_count":114,"description":"Atlantic senior editor, James Beard Award-winner, and curator of The Atlantic Food Channel.","profile_image_url":"http://a1.twimg.com/profile_images/130071282/corby_mug_yellow_normal.png","status":{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_screen_name":null,"source":"<a href=\"http://twitterfeed.com\" rel=\"nofollow\">twitterfeed</a>","created_at":"Mon Nov 09 16:51:45 +0000 2009","id":5562998741,"text":"LAST OF THE ROMANOS My favorite green beans are at end-of-season farmers markets. Try them with this secret sa.. http://bit.ly/10jqzl"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":4444,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":55555, "previous_cursor":0 }')
|
37
|
+
|
38
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=55555&user_id=15019521", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing1","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"},{"following":false,"geo_enabled":false,"statuses_count":114,"description":"Atlantic senior editor, James Beard Award-winner, and curator of The Atlantic Food Channel.","profile_image_url":"http://a1.twimg.com/profile_images/130071282/corby_mug_yellow_normal.png","status":{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_screen_name":null,"source":"<a href=\"http://twitterfeed.com\" rel=\"nofollow\">twitterfeed</a>","created_at":"Mon Nov 09 16:51:45 +0000 2009","id":5562998741,"text":"LAST OF THE ROMANOS My favorite green beans are at end-of-season farmers markets. Try them with this secret sa.. http://bit.ly/10jqzl"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":22,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
29
39
|
|
30
|
-
FakeWeb.register_uri(:any, "http://#{
|
40
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=-1&user_id=55555", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing2","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
31
41
|
|
32
|
-
FakeWeb.register_uri(:any, "http://#{
|
42
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=-1&user_id=4444", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing3","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
33
43
|
|
34
|
-
FakeWeb.register_uri(:any, "http://#{
|
44
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=-1&user_id=333", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing4","id":333,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
35
45
|
|
36
|
-
FakeWeb.register_uri(:any, "http://#{
|
46
|
+
FakeWeb.register_uri(:any, "http://#{auth_string}twitter.com/statuses/friends.json?cursor=-1&user_id=22", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"thing5","id":1,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
37
47
|
|
38
48
|
|
49
|
+
end
|
39
50
|
|
40
51
|
# FRIEND IDS METHOD
|
41
|
-
FakeWeb.register_uri(:any, "http://#{
|
52
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/friends/ids.json?user_id=15019521", :body => '[55555,4444,15019521]')
|
42
53
|
|
43
|
-
FakeWeb.register_uri(:any, "http://#{
|
54
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/friends/ids.json?user_id=55555", :body => '[4444]')
|
44
55
|
|
45
|
-
FakeWeb.register_uri(:any, "http://#{
|
56
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/friends/ids.json?user_id=4444", :body => '[333, 22, 1]')
|
46
57
|
|
47
|
-
|
48
|
-
|
58
|
+
FakeWeb.register_uri(:any, "http://twitter.com/friends/ids/15019521.json", :body => '[55555,4444,15019521]')
|
59
|
+
|
60
|
+
FakeWeb.register_uri(:any, "http://twitter.com/friends/ids/55555.json", :body => '[4444]')
|
61
|
+
|
62
|
+
FakeWeb.register_uri(:any, "http://twitter.com/friends/ids/4444.json", :body => '[333, 22, 1]')
|
49
63
|
|
50
|
-
|
64
|
+
# FOLLLOWER IDS METHOD
|
65
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/followers/ids.json?user_id=15019521", :body => '[55555,4444,15019521]')
|
66
|
+
|
67
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/followers/ids.json?user_id=55555", :body => '[4444]')
|
68
|
+
|
69
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/followers/ids.json?user_id=4444", :body => '[333, 22, 1]')
|
51
70
|
|
52
|
-
FakeWeb.register_uri(:any, "http
|
71
|
+
FakeWeb.register_uri(:any, "http://twitter.com/followers/ids/15019521.json", :body => '[55555,4444,15019521]')
|
53
72
|
|
54
|
-
FakeWeb.register_uri(:any, "http
|
73
|
+
FakeWeb.register_uri(:any, "http://twitter.com/followers/ids/55555.json", :body => '[4444]')
|
55
74
|
|
56
|
-
FakeWeb.register_uri(:any, "http
|
75
|
+
FakeWeb.register_uri(:any, "http://twitter.com/followers/ids/4444.json", :body => '[333, 22, 1]')
|
57
76
|
|
58
|
-
FakeWeb.register_uri(:any, "http://#{username}:#{password}@twitter.com/statuses/friends.json?cursor=-1&user_id=22", :body => '{"users":[{"following":null,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme1/bg.png","description":"Bars, bartenders & imbibing in Beantown","verified":false,"profile_link_color":"0000ff","status":{"in_reply_to_screen_name":null,"source":"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>","created_at":"Wed Nov 11 23:16:53 +0000 2009","in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5632679977,"favorited":false,"text":"What does one absolutely HAVE to do when visiting Seattle?"},"profile_background_tile":false,"profile_background_color":"9ae4e8","url":"http://drinkboston.com/","followers_count":343,"profile_sidebar_fill_color":"e0ff92","statuses_count":112,"created_at":"Sat Jun 13 11:24:47 +0000 2009","friends_count":141,"time_zone":"Quito","profile_sidebar_border_color":"87bc44","protected":false,"profile_image_url":"http://a3.twimg.com/profile_images/428011343/lauren_normal.jpg","notifications":null,"favourites_count":0,"location":"Boston, MA","name":"Lauren Clark","screen_name":"Drinkboston","id":1,"geo_enabled":false,"utc_offset":-18000,"profile_text_color":"000000"}], "next_cursor":0, "previous_cursor":0 }')
|
59
77
|
|
60
78
|
# USER TWEETS METHOD
|
61
|
-
FakeWeb.register_uri(:any, "http://#{
|
79
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/statuses/user_timeline.json?count=200&user_id=15019521", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
80
|
+
|
81
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/statuses/user_timeline.json?max_id=5590958294&count=200&user_id=15019521", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":4444,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
82
|
+
|
83
|
+
FakeWeb.register_uri(:any, "http://#{http_auth_string}twitter.com/statuses/user_timeline.json?max_id=4444&count=200&user_id=15019521", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":4444,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
62
84
|
|
63
|
-
FakeWeb.register_uri(:any, "http
|
85
|
+
FakeWeb.register_uri(:any, "http://twitter.com/statuses/user_timeline/15019521.json?count=200", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
64
86
|
|
65
|
-
FakeWeb.register_uri(:any, "http
|
87
|
+
FakeWeb.register_uri(:any, "http://twitter.com/statuses/user_timeline/15019521.json?max_id=5590958294&count=200", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":4444,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
66
88
|
|
89
|
+
FakeWeb.register_uri(:any, "http://twitter.com/statuses/user_timeline/15019521.json?max_id=4444&count=200", :body => %^[{"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":5590958294,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"}, {"in_reply_to_screen_name":null,"source":"web","geo":null,"created_at":"Tue Nov 10 15:22:43 +0000 2009","user":{"following":false,"profile_background_image_url":"http://s.twimg.com/a/1257800794/images/themes/theme3/bg.gif","description":"","profile_link_color":"088253","profile_background_tile":false,"followers_count":132,"profile_background_color":"EDECE9","url":null,"friends_count":133,"profile_sidebar_fill_color":"E3E2DE","notifications":false,"statuses_count":260,"favourites_count":0,"created_at":"Thu Jun 05 15:47:02 +0000 2008","time_zone":"Eastern Time (US & Canada)","profile_sidebar_border_color":"D3D2CF","protected":false,"profile_image_url":"http://a1.twimg.com/profile_images/55090134/samiamdrseuss_normal.jpg","geo_enabled":false,"location":"Cambridge, MA","name":"Sam Gilbert","screen_name":"sam1vp","id":15019521,"verified":false,"utc_offset":-18000,"profile_text_color":"634047"},"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"id":4444,"favorited":false,"text":"NEW POST (on my new, if still half-baked site), in which I complain about having too much money: www.samgilbert.org"} ]^)
|
data/test/log_test.rb
CHANGED
@@ -16,8 +16,8 @@ class LogTest < Test::Unit::TestCase
|
|
16
16
|
File.open('testlog.txt','r').each do |line|
|
17
17
|
log_string << line
|
18
18
|
end
|
19
|
-
assert log_string.include?
|
20
|
-
assert log_string.include?
|
19
|
+
assert log_string.include?("testing123")
|
20
|
+
assert log_string.include?("Project, Researcher")
|
21
21
|
end
|
22
22
|
|
23
23
|
teardown do
|
data/test/puller_test.rb
CHANGED
@@ -13,37 +13,92 @@ class PullerTest < Test::Unit::TestCase
|
|
13
13
|
should "be able to be created" do
|
14
14
|
@p.inspect
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
should "be able to pull followers for a given user" do
|
18
|
-
|
19
|
-
|
18
|
+
@pull_hash = @p.pull(@test_user, &FOLLOWERS)
|
19
|
+
assert_equal 22, TwitterAccount.find(TwitterRelationship.find(@pull_hash[:follower_relationship_db_ids].first).follower_id).twitter_id
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
should "be able to pull an array of follower ids for a given user_id" do
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
23
|
+
@pull_hash = @p.pull(@test_user, &FOLLOWER_IDS)
|
24
|
+
assert_equal @pull_hash[:follower_relationship_db_ids].class, Array
|
25
|
+
end
|
26
|
+
|
27
|
+
should "be able to pull friends for a given user" do
|
28
|
+
TwitterAccount.delete_all
|
29
|
+
@pull_hash = @p.pull(@test_user, &FRIENDS)
|
30
|
+
assert_equal 55555, TwitterAccount.find(TwitterRelationship.find(@pull_hash[:friend_relationship_db_ids].first).friend_id).twitter_id
|
31
|
+
end
|
32
|
+
|
33
|
+
should "be able to pull an array of friend IDs for a given user_id" do
|
34
|
+
@pull_hash = @p.pull(@test_user, &FRIEND_IDS)
|
35
|
+
assert_equal @pull_hash[:friend_relationship_db_ids].class, Array
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be able to pull tweets from a user's timeline for a given user" do
|
39
|
+
Tweet.delete_all
|
40
|
+
@initial_size = Tweet.all.size
|
41
|
+
@pull_hash = @p.pull(@test_user, &TWEETS)
|
42
|
+
assert_equal @initial_size + 6, Tweet.all.size
|
43
|
+
end
|
44
|
+
|
41
45
|
|
46
|
+
should "be able to pull info from twitter for a user" do
|
47
|
+
@pull_hash = @p.pull(@test_user, &ACCOUNT_INFO)
|
48
|
+
assert_equal @pull_hash[:pull_data].screen_name, 'sam1vp'
|
49
|
+
end
|
50
|
+
|
51
|
+
context "given a user with a since_tweet_id of specified" do
|
52
|
+
setup do
|
53
|
+
db_user_object = TwitterAccount.create({:twitter_id => 15019521,:screen_name => 'sam1vp'})
|
54
|
+
@test_user = Pork::TwitterUser.new(:twitter_id => 15019521, :db_object => db_user_object, :since_tweet_id => 4444)
|
55
|
+
end
|
56
|
+
should "not save tweets with ids at or below 4444" do
|
57
|
+
@pull_hash = @p.pull(@test_user, &TWEETS)
|
58
|
+
@pull_hash[:db_ids].each do |db_id|
|
59
|
+
assert Tweet.find(db_id).status_id > 4444
|
60
|
+
end
|
61
|
+
assert_equal 2, @pull_hash[:db_ids].size
|
62
|
+
end
|
63
|
+
end
|
42
64
|
|
65
|
+
end
|
66
|
+
context "An unauthenticated default puller" do
|
67
|
+
setup do
|
68
|
+
$SAVER = Pork::Saver.new
|
69
|
+
@p = Pork::Puller.new()
|
70
|
+
@user_info_keys = ["created_at", "description", "favourites_count", "followers_count", "following", "friends_count", "geo_enabled", "id", "location", "name", "notifications", "profile_background_color", "profile_background_image_url", "profile_background_tile", "profile_image_url", "profile_link_color", "profile_sidebar_border_color", "profile_sidebar_fill_color", "profile_text_color", "protected", "screen_name", "status", "statuses_count", "time_zone", "url", "utc_offset", "verified"]
|
71
|
+
db_user_object = TwitterAccount.create({:twitter_id => 15019521,:screen_name => 'sam1vp'})
|
72
|
+
@test_user = Pork::TwitterUser.new(:twitter_id => 15019521, :db_object => db_user_object)
|
73
|
+
end
|
74
|
+
should "be able to be created" do
|
75
|
+
@p.inspect
|
76
|
+
end
|
77
|
+
should "be able to pull followers for a given user" do
|
78
|
+
@pull_hash = @p.pull(@test_user, &FOLLOWERS)
|
79
|
+
assert_equal 22, TwitterAccount.find(TwitterRelationship.find(@pull_hash[:follower_relationship_db_ids].first).follower_id).twitter_id
|
80
|
+
end
|
81
|
+
should "be able to pull an array of follower ids for a given user_id" do
|
82
|
+
@pull_hash = @p.pull(@test_user, &FOLLOWER_IDS)
|
83
|
+
assert_equal @pull_hash[:follower_relationship_db_ids].class, Array
|
84
|
+
end
|
85
|
+
should "be able to pull friends for a given user" do
|
86
|
+
@pull_hash = @p.pull(@test_user, &FRIENDS)
|
87
|
+
assert_equal 55555, TwitterAccount.find(TwitterRelationship.find(@pull_hash[:friend_relationship_db_ids].first).friend_id).twitter_id
|
88
|
+
end
|
89
|
+
should "be able to pull an array of friend IDs for a given user_id" do
|
90
|
+
@pull_hash = @p.pull(@test_user, &FRIEND_IDS)
|
91
|
+
assert_equal @pull_hash[:friend_relationship_db_ids].class, Array
|
92
|
+
end
|
93
|
+
should "be able to pull tweets from a user's timeline for a given user" do
|
94
|
+
Tweet.delete_all
|
95
|
+
@initial_size = Tweet.all.size
|
96
|
+
@pull_hash = @p.pull(@test_user, &TWEETS)
|
97
|
+
assert_equal @initial_size + 6, Tweet.all.size
|
98
|
+
end
|
43
99
|
should "be able to pull info from twitter for a user" do
|
44
100
|
@pull_hash = @p.pull(@test_user, &ACCOUNT_INFO)
|
45
101
|
assert_equal @pull_hash[:pull_data].screen_name, 'sam1vp'
|
46
102
|
end
|
47
|
-
|
48
103
|
end
|
49
|
-
end
|
104
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 17
|
9
|
+
version: 0.4.17
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sam Gilbert
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-13 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|