pork_sandwich 0.4.7 → 0.4.8
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/VERSION +1 -1
- data/lib/pork_sandwich/puller.rb +7 -7
- data/test/test_helper.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.8
|
data/lib/pork_sandwich/puller.rb
CHANGED
@@ -3,7 +3,7 @@ module Pork
|
|
3
3
|
attr_accessor :auth_object
|
4
4
|
|
5
5
|
def initialize(auth_object = nil)
|
6
|
-
@auth_object = auth_object
|
6
|
+
@auth_object = auth_object.auth
|
7
7
|
end
|
8
8
|
|
9
9
|
def pull(user_object, &pull_type)
|
@@ -37,7 +37,7 @@ end
|
|
37
37
|
|
38
38
|
|
39
39
|
ACCOUNT_INFO = lambda do |user_object, auth_object|
|
40
|
-
@pull_data = auth_object.
|
40
|
+
@pull_data = auth_object.user(user_object.search)
|
41
41
|
{:pull_data => @pull_data, :db_object => $SAVER.save(@pull_data, &TWITTER_ACCOUNT_SAVE)}
|
42
42
|
end
|
43
43
|
|
@@ -50,7 +50,7 @@ FOLLOWERS = lambda do |user, auth_object|
|
|
50
50
|
# end
|
51
51
|
loop do
|
52
52
|
rules[:cursor] = -1 if !rules[:cursor]
|
53
|
-
@pull_data = auth_object.
|
53
|
+
@pull_data = auth_object.followers(rules)
|
54
54
|
@pull_data.users.each do |follower_mash|
|
55
55
|
db_user_object = $SAVER.save(follower_mash, &TWITTER_ACCOUNT_SAVE)
|
56
56
|
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
|
@@ -69,7 +69,7 @@ FOLLOWER_IDS = lambda do |user, auth_object|
|
|
69
69
|
# rules[:user_id] = user.twitter_id
|
70
70
|
$SAVER.rules[:complete_follower_set] = true
|
71
71
|
follower_relationship_db_ids = []
|
72
|
-
@pull_data = auth_object.
|
72
|
+
@pull_data = auth_object.follower_ids({:user_id => user.twitter_id})
|
73
73
|
@pull_data.each do |user_id|
|
74
74
|
db_user_object = $SAVER.save(Pork::TwitterUser.new(:twitter_id => user_id), &TWITTER_ACCOUNT_SAVE)
|
75
75
|
follower_relationship_db_ids << $SAVER.save({:friend => user, :follower => Pork::TwitterUser.new(:twitter_id => user_id, :db_object => db_user_object)}, &RELATIONSHIP_SAVE)
|
@@ -87,7 +87,7 @@ FRIENDS = lambda do |user, auth_object|
|
|
87
87
|
# end
|
88
88
|
loop do
|
89
89
|
rules[:cursor] = -1 if !rules[:cursor]
|
90
|
-
@pull_data = auth_object.
|
90
|
+
@pull_data = auth_object.friends(rules)
|
91
91
|
@pull_data.users.each do |friend_mash|
|
92
92
|
db_user_object = $SAVER.save(friend_mash, &TWITTER_ACCOUNT_SAVE)
|
93
93
|
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
|
@@ -106,7 +106,7 @@ FRIEND_IDS = lambda do |user, auth_object|
|
|
106
106
|
# rules[:user_id] = user.twitter_id
|
107
107
|
$SAVER.rules[:complete_friend_set] = true
|
108
108
|
friend_relationship_db_ids = []
|
109
|
-
@pull_data = auth_object.
|
109
|
+
@pull_data = auth_object.friend_ids({:user_id => user.twitter_id})
|
110
110
|
@pull_data.each do |user_id|
|
111
111
|
db_user_object = $SAVER.save(Pork::TwitterUser.new(:twitter_id => user_id), &TWITTER_ACCOUNT_SAVE)
|
112
112
|
friend_relationship_db_ids << $SAVER.save({:follower => user, :friend => Pork::TwitterUser.new(:twitter_id => user_id, :db_object => db_user_object)}, &RELATIONSHIP_SAVE)
|
@@ -123,7 +123,7 @@ TWEETS = lambda do |user, auth_object|
|
|
123
123
|
rules[:screen_name] = user.screen_name
|
124
124
|
end
|
125
125
|
@tweet_db_ids = []
|
126
|
-
@pull_data = auth_object.
|
126
|
+
@pull_data = auth_object.user_timeline(rules)
|
127
127
|
@pull_data.each do |result|
|
128
128
|
@tweet_db_ids << $SAVER.save(result, &USER_TWEET_SAVE).id
|
129
129
|
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ require "#{File.dirname(__FILE__)}/../lib/pork_sandwich"
|
|
16
16
|
class Test::Unit::TestCase
|
17
17
|
include RR::Adapters::TestUnit
|
18
18
|
config = YAML::load(File.open("#{File.dirname(__FILE__)}/../config/pork_config.yml"))
|
19
|
-
$AUTH = Pork::Auth.new(config['config']['twitter_auth']['username'], config['config']['twitter_auth']['password'], :user_agent => 'web_ecology_project')
|
19
|
+
$AUTH = Pork::Auth.new(config['config']['twitter_auth']['username'], config['config']['twitter_auth']['password'], :user_agent => 'web_ecology_project')
|
20
20
|
end
|
21
21
|
|
22
22
|
|