Monday, April 27, 2009

Using Ruby oauth gem to access Netflix

The example at Mandarin Soda didn't work for the latest version of the Ruby oauth gem (version 0.3.2.2 as of this writing). Took me a day to work out all the differences. The slightly alter code is a gist on GitHub (and reproduced here). The differences are:
  • :request_token_url is http instead of https
  • access_token.response is a subclass of Net::HTTPResponse so there's no access_token.response[:user_id]; rather, you get the user ID with access_token.params[:user_id]
  • using access_token.get(url) instead of consumer.request(:get, url, access_token, {:scheme => :query_string}) but I think they're the same (and the latter still works)
Link

Labels: , ,

0 Comments:

Post a Comment

<< Home