-
-
Save wghirakawa/9404536 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
// | |
// Aaron K. Saunders | |
// | |
// http://www.clearlyinnovative.com | |
// http://blog.clearlyinnovative.com | |
// @aaronksaunders | |
// | |
// SEE http://bytespider.github.com/jsOAuth/ for jsOAuth.js | |
// | |
Ti.include("jsOAuth.js"); | |
var auth = { | |
// Update with your auth tokens | |
consumerKey : "xxxxxxxxxxx", | |
consumerSecret : "xxxxxxxxxxxxxxx", | |
accessTokenKey : "xxxxxxxxxxxxxxxxxx", | |
accessTokenSecret : "xxxxxxxxxxxxxxxxx", | |
serviceProvider : { | |
signatureMethod : "HMAC-SHA1" | |
} | |
}; | |
var oauth = OAuth(auth); | |
var args = { | |
params : {}, | |
method : "GET" | |
}; | |
var options = { | |
'method' : "GET", | |
//'headers' : headers, | |
'url' : 'http://api.yelp.com/v2/business/bay-to-breakers-12k-san-francisco', | |
'data' : (args.method === 'PUT' || args.method === 'POST') ? JSON.stringify(args.params) : args.params, | |
'success' : function(data) { | |
var response = data; | |
Ti.API.info('success - response ' + response); | |
if(args.success !== undefined) { | |
args.success(data); | |
} | |
}, | |
'failure' : function(data) { | |
var response = JSON.stringify(data); | |
Ti.API.info('failure - response ' + response); | |
if(args.success !== undefined) { | |
args.error(data) | |
} | |
} | |
} | |
// Make the request | |
oauth.request(options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You double stringily the response. The response is already stringified via JSOAUTH in the latest version of JSOUTH