Kubrick

A simple Ruby wrapper for the Netflix REST API


Kubrick is a Ruby wrapper for the Netflix REST API. It is nowhere near ready for use.

Usage

  1. Go to the Netflix API keys website and sign up for an account if you haven't done so yet. Register an application.

  2. Start the OAuth authentication process. Kubrick's OAuth setup is designed to be as simple as possible. Start by initializing the Authenticator class and passing in your consumer key and secret:

    authenticator = Kubrick::Authenticator.new("consumer key", "consumer secret")

Next, get a request token. Note that you must save this temporarily somehow as you will need it after you redirect your user to Netflix's login page.

request_token = authenticator.get_request_token

Pass the output of that method and your callback URL into login_url to get the URL you should redirect your user to:

redirect_url = authenticator.(request_token, "callback_url")

When your user returns, pass your request token (the one you had to save earlier) into get_access_token.

access_token = authenticator.get_access_token(request_token)

MAKE SURE TO SAVE THE ACCESS TOKEN. It won't change unless the user revokes access to your application.

You can now make calls by passing in the access token details and your consumer details. Like this:

m = Kubrick::Movie.new(access_token, {:oauth_consumer_key => "consumer_key", :oauth_consumer_secret => "consumer_secret"})
m.find_by_title("2001: A Space Odyssey")

Warning!

Kubrick is by no means ready for use. It's not even close to complete. If you want to use it, go ahead, but be warned that the API's may change by surprise.

Do whatever the heck you want with this. Fork it, rewrite, sell it as your own. I don't care. But please retain credit to me and any contributors.

© Copyright 2012 J-P Teti.