Skip to content

Commit

Permalink
Remove search endpoint
Browse files Browse the repository at this point in the history
In API v1.1, search uses the default endpoint.

See: https://dev.twitter.com/docs/api/1.1/get/search/tweets
  • Loading branch information
sferik committed Sep 7, 2012
1 parent 540cbb2 commit 37610fe
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/twitter/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ def saved_search_destroy(*args)
# @example Returns tweets related to twitter
# Twitter.search('twitter')
def search(q, options={})
object_from_response(Twitter::SearchResults, :get, "/search.json", options.merge(:q => q), :endpoint => @search_endpoint)
object_from_response(Twitter::SearchResults, :get, "/1.1/search/tweets.json", options.merge(:q => q))
end

# Returns recent Tweets related to a query with images and videos embedded
Expand Down
3 changes: 1 addition & 2 deletions lib/twitter/configurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Twitter
module Configurable
attr_writer :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret
attr_accessor :endpoint, :media_endpoint, :search_endpoint, :connection_options, :identity_map, :middleware
attr_accessor :endpoint, :media_endpoint, :connection_options, :identity_map, :middleware

class << self

Expand All @@ -15,7 +15,6 @@ def keys
:oauth_token_secret,
:endpoint,
:media_endpoint,
:search_endpoint,
:connection_options,
:identity_map,
:middleware,
Expand Down
6 changes: 0 additions & 6 deletions lib/twitter/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module Twitter
module Default
ENDPOINT = 'https://api.twitter.com' unless defined? ENDPOINT
MEDIA_ENDPOINT = 'https://upload.twitter.com' unless defined? MEDIA_ENDPOINT
SEARCH_ENDPOINT = 'https://search.twitter.com' unless defined? SEARCH_ENDPOINT
CONNECTION_OPTIONS = {
:headers => {
:accept => 'application/json',
Expand Down Expand Up @@ -85,11 +84,6 @@ def media_endpoint
MEDIA_ENDPOINT
end

# @return [String]
def search_endpoint
SEARCH_ENDPOINT
end

# @return [Hash]
def connection_options
CONNECTION_OPTIONS
Expand Down
6 changes: 3 additions & 3 deletions spec/twitter/api/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

describe "#search" do
before do
stub_get("/search.json", "https://search.twitter.com").
stub_get("/1.1/search/tweets.json").
with(:query => {:q => "twitter"}).
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.search('twitter')
a_get("/search.json", "https://search.twitter.com").
a_get("/1.1/search/tweets.json").
with(:query => {:q => "twitter"}).
should have_been_made
end
Expand All @@ -32,7 +32,7 @@

context "when search API responds a malformed result" do
before do
stub_get("/search.json", "https://search.twitter.com").
stub_get("/1.1/search/tweets.json").
with(:query => {:q => "twitter"}).
to_return(:body => fixture("/search_malformed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
Expand Down
1 change: 0 additions & 1 deletion spec/twitter/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
:middleware => Proc.new{},
:oauth_token => 'OT',
:oauth_token_secret => 'OS',
:search_endpoint => 'http://search.twitter.com',
:identity_map => ::Hash
}
end
Expand Down

0 comments on commit 37610fe

Please sign in to comment.