Hi , I am writing a rake task to consume twitter stream API. The task
contains the following code:
consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, :site =>
‘http://twitter.com’)
access_token =
OAuth::AccessToken.new(consumer,ACCESS_TOKEN,ACCESS_TOKEN_SECRET)
oauth_params = {:consumer => consumer, :token => access_token}
EventMachine.run do
# now, let’s subscribe to twitter site stream
# check informaiton on twitter site
http =
EventMachine::HttpRequest.new(‘http://stream.twitter.com/1/statuses/sample.json’).get
oauth_helper = OAuth::Client::Helper.new(http, oauth_params)
http.options[:head] = (http.options[:head] ||
{}).merge!({“Authorization” => oauth_helper.header})
http.callback {
p http.response
EventMachine.stop
}
The rake gets aborted with the following error:
undefined method options' for #<EventMachine::HttpClient:0x42cf9f0> D:/ROR/LOCAL_TWEETS/lib/tasks/twitter.rake:40:in
block in <top
(required)>’
D:/Ruby192/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4.1-x86-mingw32/lib/
eventmachine.rb:179:in `call’
I am working on Windows 7, x64, and the gems I use are
em-http-request (1.0.0)
oauth (0.4.5)
eventmachine (1.0.0.beta.4.1)
Any ideas on how to resolve this ??