Skip to content

Commit

Permalink
Merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Wynn Netherland committed Nov 29, 2009
2 parents b20b770 + 9dcd340 commit c5354c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 14 additions & 1 deletion lib/twitter/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,21 @@ def since(since_id)
@query[:since_id] = since_id
self
end

# From the advanced search form, not documented in the API
# Format YYYY-MM-DD
def since_date(since_date)
@query[:since] = since_date
self
end

# From the advanced search form, not documented in the API
# Format YYYY-MM-DD
def until_date(until_date)
@query[:until] = until_date
self
end

# Search tweets by latitude, longitude, and a given range.
# Ranges like 25km and 50mi work.
def geocode(lat, long, range)
@query[:geocode] = [lat, long, range].join(',')
Expand Down
14 changes: 13 additions & 1 deletion test/twitter/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ class SearchTest < Test::Unit::TestCase
@search.fetch()
end

should "should be able to specify since a date" do
@search.since_date('2009-04-14')
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :since => '2009-04-14', :q => ''}, :format => :json).returns({ 'foo' => 'bar'})
@search.fetch
end

should "should be able to specify until a date" do
@search.until_date('2009-04-14')
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :until => '2009-04-14', :q => ''}, :format => :json).returns({ 'foo' => 'bar'})
@search.fetch
end

should "should be able to specify geo coordinates" do
@search.geocode('40.757929', '-73.985506', '25mi')
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => {:geocode => '40.757929,-73.985506,25mi', :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({'foo' => 'bar'})
Expand Down Expand Up @@ -156,4 +168,4 @@ class SearchTest < Test::Unit::TestCase
end
end

end
end

0 comments on commit c5354c6

Please sign in to comment.