Created
January 6, 2009 20:51
-
-
Save mojodna/43984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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