Skip to content

Instantly share code, notes, and snippets.

@mojodna

mojodna/gist:43984

Created Jan 6, 2009
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.