Created
October 15, 2010 02:52
-
-
Save sethladd/627520 to your computer and use it in GitHub Desktop.
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
{ | |
"kind": "chromewebstore#license", | |
"id": "ejbknjbccnnccddiljheadjafeeagcan/https://www.google.com/accounts/o8/id?id\u003dAItOawlh_ZYIBQi-kNV-d3Rd8WIjQEBsLDh5LDQ", | |
"appId": "ejbknjbccnnccddiljheadjafeeagcan", | |
"userId": "https://www.google.com/accounts/o8/id?id\u003dAItOawlh_ZYIBQi-kNV-d3Rd8WIjQEBsLDh5LDQ", | |
"result": "YES", | |
"accessLevel": "FREE_TRIAL" | |
} |
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
app_id = "YOUR APP ID" | |
access_token_scope = "https://www.googleapis.com/auth/chromewebstore.readonly" | |
oauth_signature_method = "HMAC-SHA1" | |
consumer_key = "anonymous" | |
consumer_secret = "anonymous" | |
oauth_token_secret = "YOUR OAUTH TOKEN SECRET" | |
oauth_token = "YOUR OAUTH TOKEN" | |
require 'signet/oauth_1/client' | |
client = Signet::OAuth1::Client.new( | |
:client_credential_key => consumer_key, | |
:client_credential_secret => consumer_secret, | |
:token_credential_key => oauth_token, | |
:token_credential_secret => oauth_token_secret | |
) | |
# a test user, from http://code.google.com/chrome/webstore/docs/check_for_payment.html#test | |
free_trial_user_identity = 'https://www.google.com/accounts/o8/id?id=AItOawlh_ZYIBQi-kNV-d3Rd8WIjQEBsLDh5LDQ' | |
openid_uri = Signet::OAuth1.encode(free_trial_user_identity) | |
request_uri = 'https://www.googleapis.com/chromewebstore/v1/licenses/'+app_id+'/'+openid_uri | |
response = client.fetch_protected_resource( | |
:uri => request_uri | |
) | |
status, headers, body = response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment