Permalink
Browse files

Remove search endpoint

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 6, 2012
1 parent 540cbb2 commit 37610fe6d54686238aedaee53914e70e67040d59
Showing with 5 additions and 13 deletions.
  1. +1 −1 lib/twitter/api.rb
  2. +1 −2 lib/twitter/configurable.rb
  3. +0 −6 lib/twitter/default.rb
  4. +3 −3 spec/twitter/api/search_spec.rb
  5. +0 −1 spec/twitter/client_spec.rb
View
@@ -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
@@ -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
@@ -15,7 +15,6 @@ def keys
:oauth_token_secret,
:endpoint,
:media_endpoint,
- :search_endpoint,
:connection_options,
:identity_map,
:middleware,
View
@@ -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',
@@ -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
@@ -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
@@ -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
@@ -41,7 +41,6 @@
:middleware => Proc.new{},
:oauth_token => 'OT',
:oauth_token_secret => 'OS',
- :search_endpoint => 'http://search.twitter.com',
:identity_map => ::Hash
}
end

0 comments on commit 37610fe

Please sign in to comment.