Created
September 25, 2012 23:55
-
-
Save Xegyn/3785176 to your computer and use it in GitHub Desktop.
Sample : YQL Query Using Omniauth, Omniauth-Oauth and Omniauth-Yahoo
This file contains hidden or 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
require 'oauth' | |
require 'oauth/consumer' | |
require 'oauth/token' | |
require 'omniauth-yahoo' | |
key = 'Xdj0yJmk9VFV…..' | |
secret = '478787sha878978950e….' | |
options = { | |
:access_token_path => '/oauth/v2/get_token', | |
:authorize_path => '/oauth/v2/request_auth', | |
:request_token_path => '/oauth/v2/get_request_token', | |
:site => 'https://api.login.yahoo.com' | |
} | |
consumer = Consumer.new key, secret, options | |
request_token = consumer.get_request_token | |
request_token.authorize_url | |
# redirect_to request_token.authorize_url | |
# When user returns create an access_token | |
access_token = request_token.get_access_token :oath_verifier => '<verifier>' # User goes to the request_token.authorize_url and enters the verifier here | |
yql = "SELECT * FROM social.profile WHERE guid=me" | |
response = consumer.request(:get, "http://query.yahooapis.com/v1/yql?q=#{URI.escape(yql)}&format=json", access_token) | |
puts response.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment