Skip to content

Commit

Permalink
removed old tumblr api reference and updated it to use the new 2.0 me…
Browse files Browse the repository at this point in the history
…thods
  • Loading branch information
icodeforlove committed Sep 7, 2012
1 parent 6c1248f commit e97a4f7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/modules/tumblr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e97a4f7

Please sign in to comment.