ruby on rails - What are query_parameters and how do I pass them to Tweetstream::Client...filter(query_parameters = {}) -
i using tweetstream gem retrieve statuses twitter. works:
tweetstream::client.new('user', 'pw').track('alice', 'wonderland')
however, know want limit collecting tweets both (i) specific users (ii) specific words. tweetstream gem provides method:
tweetstream::client.new('user', 'pw').filter(query_params = {}, &block)
but can't figure out how pass query_parameters = {}. i'm trying this:
tweetstream::client.new('user', 'pw').filter( {:follow => ('212380730', '23234252'), :track => ('alice', 'wonderland') } )
but errors related syntax, e.g.,
syntax error, unexpected tsymbeg, expecting '}'
thank help!
the following tweetstream rdoc: filter(query_params = {}, &block)
make call statuses/filter method of streaming api, may provide :follow, :track or both options follow tweets of specified users or track keywords. method provided separately cases when conserve number of http connections combine track , follow.
this source of .filter method:
def filter(query_params = {}, &block) [:follow, :track].each |param| if query_params[param].is_a?(array) query_params[param] = query_params[param].collect{|q| q.to_s}.join(',') elsif query_params[param] query_params[param] = query_params[param].to_s end end start('statuses/filter', query_params.merge(:method => :post), &block) end
i think mean [] instead of using () filter , track, :filter , :track in query params supposed arrays
Comments
Post a Comment