rares (owner)

Revisions

gist: 25407 Download_button fork
public
Public Clone URL: git://gist.github.com/25407.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$:.unshift File.dirname(__FILE__) + "/lib"
require "oauth/consumer"
require "pp"
 
consumer = OAuth::Consumer.new(
  "<consumer.key>",
  "<consumer.secret>",
  {
    :site => "http://api.netflix.com",
    :request_token_url => "https://api-user.netflix.com/oauth/request_token",
    :access_token_url => "http://api.netflix.com/oauth/access_token",
    :authorize_url => "https://api-user.netflix.com/oauth/login"
  })
 
request_token = consumer.get_request_token
 
puts request_token.authorize_url({
  :oauth_consumer_key => "<consumer.key>",
  :application_name => "<your.app.name>",
  :oauth_callback => "http://cnn.com/"
})
 
sleep 15 # at this point paste the link outputted in the console and access it. click on the button to authorize.
 
access_token = request_token.get_access_token
puts access_token.get("/users/#{access_token.response[:user_id]}")