Merge pull request #1492 from dsander/twitter-api-version

Use version 1.1 of twitter stream API endpoint

Dominik Sander vor 9 Jahren
Ursprung
Commit
74d8ab9de0
2 geänderte Dateien mit 2 neuen Zeilen und 2 gelöschten Zeilen
  1. 1 1
      app/models/agents/twitter_stream_agent.rb
  2. 1 1
      spec/models/agents/twitter_stream_agent_spec.rb

+ 1 - 1
app/models/agents/twitter_stream_agent.rb

@@ -182,7 +182,7 @@ module Agents
182 182
         filters = filters.map(&:downcase).uniq
183 183
 
184 184
         stream = Twitter::JSONStream.connect(
185
-          :path    => "/1/statuses/#{(filters && filters.length > 0) ? 'filter' : 'sample'}.json#{"?track=#{filters.map {|f| CGI::escape(f) }.join(",")}" if filters && filters.length > 0}",
185
+          :path    => "/1.1/statuses/#{(filters && filters.length > 0) ? 'filter' : 'sample'}.json#{"?track=#{filters.map {|f| CGI::escape(f) }.join(",")}" if filters && filters.length > 0}",
186 186
           :ssl     => true,
187 187
           :oauth   => {
188 188
             :consumer_key    => agent.twitter_consumer_key,

+ 1 - 1
spec/models/agents/twitter_stream_agent_spec.rb

@@ -212,7 +212,7 @@ describe Agents::TwitterStreamAgent do
212 212
       end
213 213
 
214 214
       it "initializes Twitter::JSONStream" do
215
-        mock(Twitter::JSONStream).connect({:path=>"/1/statuses/filter.json?track=agent",
215
+        mock(Twitter::JSONStream).connect({:path=>"/1.1/statuses/filter.json?track=agent",
216 216
                                            :ssl=>true, :oauth=>{:consumer_key=>"twitteroauthkey",
217 217
                                            :consumer_secret=>"twitteroauthsecret",
218 218
                                            :access_key=>"1234token",