Skip to content

Commit

Permalink
Added result_type to search for popular, recent search
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwynn committed Mar 20, 2010
1 parent 7e9b175 commit c32fa81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions History
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.9.0 - March 20, 2010
* Added support for popular/recent search
* Patch from @sferik for API versioning and bulk user import
* Patch from @abozanich for search exclusions
0.8.6 - March 11, 2010
Expand Down
6 changes: 6 additions & 0 deletions lib/twitter/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def lang(lang)
@query[:lang] = lang
self
end

# popular|recent
def result_type(result_type)
@query[:result_type] = result_type
self
end

# Limits the number of results per page
def per_page(num)
Expand Down
6 changes: 6 additions & 0 deletions test/twitter/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ class SearchTest < Test::Unit::TestCase
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => {:phrase => "Who Dat", :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({'foo' => 'bar'})
@search.fetch()
end

should "should be able to set the result type" do
@search.result_type("popular")
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => {:result_type => 'popular', :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({'foo' => 'bar'})
@search.fetch()
end

should "should be able to clear the filters set" do
@search.from('jnunemaker').to('oaknd1')
Expand Down

0 comments on commit c32fa81

Please sign in to comment.