Skip to content

Instantly share code, notes, and snippets.

@mojodna
Created January 6, 2009 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojodna/43984 to your computer and use it in GitHub Desktop.
Save mojodna/43984 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "oauth"
require 'oauth/helper'
require 'oauth/client/helper'
require 'oauth/request_proxy/net_http'
require "yaml"
require 'oauth_monkey_patches'
url = "http://query.yahooapis.com/v1/yql?q=show%20tables&format=xml"
options = YAML.load(File.read("yql.yml"))
puts "consumer key: #{options[:consumer_key]}"
puts "shared secret: #{options[:shared_secret]}"
consumer = OAuth::Consumer.new \
options[:consumer_key],
options[:shared_secret], # TODO rename me to consumer_secret
:site => "http://query.yahooapis.com"
# # get a request token
# request_token = consumer.get_request_token
#
# # get the authorization url
# request_token.authorize_url
#
# # get an access token
# access_token = request_token.get_access_token
access_token = OAuth::AccessToken.new(consumer)
# make the request
response = access_token.request(:get, "/v1/yql?q=show%20tables&format=xml")
puts "Response: #{response.body}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment