Quoting Anait M. <[email protected]>:
> 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
>    }

Not sure what you are trying to accomplish here, I'm not familiar with OAuth.
A couple of points.  The htpp = ....get statements makes the request, no point
in altering the GET request after the fact.  Perhaps you want something like:

url = '....
headers = {'Authorization' => oauth_helper.header}
http = EventMachine::HttpRequest.new(url, :head => headers).get
http.callback {
  p http.response
  EventMachine.stop
}

HTH,
  Jeffrey

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to