Skip to content
Browse files

removed old tumblr api reference and updated it to use the new 2.0 me…

…thods
  • Loading branch information...
1 parent 6c1248f commit e97a4f74dff67e2c21c51f5d0517f5e52f333506 @icodeforlove icodeforlove committed Sep 6, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/modules/tumblr.js
View
18 lib/modules/tumblr.js
@@ -3,22 +3,24 @@ var oauthModule = require('./oauth')
var twitter = module.exports =
oauthModule.submodule('tumblr')
- .apiHost('http://www.tumblr.com/api')
+ .apiHost('http://api.tumblr.com/v2')
.oauthHost('http://www.tumblr.com')
.entryPath('/auth/tumblr')
.callbackPath('/auth/tumblr/callback')
.sendCallbackWithAuthorize(false)
.fetchOAuthUser( function (accessToken, accessTokenSecret, params) {
var promise = this.Promise();
- this.oauth.get(this.apiHost() + '/authenticate', accessToken, accessTokenSecret, function (err, data) {
+ this.oauth.get(this.apiHost() + '/user/info', accessToken, accessTokenSecret, function (err, data) {
if (err) return promise.fail(err);
- var parser = new Parser();
- parser.on('end', function (result) {
- var oauthUser = result.tumblelog['@'];
- promise.fulfill(oauthUser);
- });
- parser.parseString(data);
+
+ try {
+ data = JSON.parse(data);
+ promise.fulfill(data.response.user);
+ } catch (e) {
+ promise.fail(e);
+ }
});
+
return promise;
})
.convertErr( function (data) {

0 comments on commit e97a4f7

Please sign in to comment.
Something went wrong with that request. Please try again.