pork_sandwich 0.4.13 → 0.4.14
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/search.rb +6 -9
- data/test/search_test.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.14
|
data/lib/pork_sandwich/search.rb
CHANGED
@@ -29,21 +29,18 @@ module Pork
|
|
29
29
|
@tweets_pulled = @return_data.results
|
30
30
|
@tweets_pulled.each do |tweet|
|
31
31
|
tweet.status_id = tweet.id
|
32
|
+
if reached_desired_count? or reached_since_id?(tweet.status_id)
|
33
|
+
break
|
34
|
+
end
|
32
35
|
@db_ids_created << $SAVER.save(tweet, &TWEET_SAVE).id
|
33
36
|
# $CRAWLER.append(tweet.from_user) if @collect_users
|
34
37
|
@current_count += 1
|
35
|
-
if reached_desired_count?
|
36
|
-
break
|
37
|
-
end
|
38
38
|
end
|
39
|
-
if reached_desired_count? or @search_params.query[:max_id] == @tweets_pulled.last.id
|
39
|
+
if reached_desired_count? or @search_params.query[:max_id] == @tweets_pulled.last.id or reached_since_id?(@tweets_pulled.last.id)
|
40
40
|
break
|
41
41
|
else
|
42
42
|
@search_params.query[:max_id] = @tweets_pulled.last.id
|
43
43
|
end
|
44
|
-
if reached_since_id?
|
45
|
-
break
|
46
|
-
end
|
47
44
|
manage_pull_rate(time_at_start)
|
48
45
|
end
|
49
46
|
rescue Twitter::Unavailable
|
@@ -112,9 +109,9 @@ module Pork
|
|
112
109
|
end
|
113
110
|
end
|
114
111
|
|
115
|
-
def reached_since_id?
|
112
|
+
def reached_since_id?(id)
|
116
113
|
if @since_id
|
117
|
-
return
|
114
|
+
return id <= @since_id
|
118
115
|
else
|
119
116
|
return false
|
120
117
|
end
|
data/test/search_test.rb
CHANGED
@@ -48,10 +48,10 @@ class SearchTest < Test::Unit::TestCase
|
|
48
48
|
setup do
|
49
49
|
@search = Pork::Search.new('test', {:since_id => 5624809937})
|
50
50
|
end
|
51
|
-
should "be able to do an historical pull for only
|
51
|
+
should "be able to do an historical pull for only 1 tweet (because the second tweet id will = 5624809937)" do
|
52
52
|
result = @search.historical_pull
|
53
53
|
assert_equal true, result
|
54
|
-
assert_equal
|
54
|
+
assert_equal 1, @search.current_count
|
55
55
|
end
|
56
56
|
end
|
57
57
|
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
|
+
- 14
|
9
|
+
version: 0.4.14
|
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-10 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|