From e79cc1fdb306da24462c6617b118e03ccbead9f1 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Tue, 14 Apr 2009 14:23:04 -0400 Subject: [PATCH] Added max to search to specify max_id for searches. --- History | 4 ++++ lib/twitter/search.rb | 5 +++++ test/twitter/search_test.rb | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/History b/History index 04ac6a4da..e1b0c5795 100644 --- a/History +++ b/History @@ -1,3 +1,7 @@ +0.6.2 - April 14, 2009 +* 1 minor addition + * added max to search so you can set the max id that should be used + 0.6.1 - April 12, 2009 * 1 minor fix * Had two friend_ids functions. Renamed one of them to follower_ids. diff --git a/lib/twitter/search.rb b/lib/twitter/search.rb index c73874cc1..8c9968e58 100644 --- a/lib/twitter/search.rb +++ b/lib/twitter/search.rb @@ -75,6 +75,11 @@ def geocode(long, lat, range) self end + def max(id) + @query[:max_id] = id + self + end + # Clears all the query filters to make a new search def clear @fetch = nil diff --git a/test/twitter/search_test.rb b/test/twitter/search_test.rb index 2d72bc3fc..ab35551e8 100644 --- a/test/twitter/search_test.rb +++ b/test/twitter/search_test.rb @@ -72,6 +72,12 @@ class SearchTest < Test::Unit::TestCase @search.fetch() end + should "should be able to specify max id" do + @search.max(1234) + @search.class.expects(:get).with('http://search.twitter.com/search.json', :query => {:max_id => 1234, :q => ''}, :format => :json).returns({'foo' => 'bar'}) + @search.fetch() + end + should "should be able to clear the filters set" do @search.from('jnunemaker').to('oaknd1') @search.clear.query.should == {:q => []}