From fff838aa912e2ef1ffcae802a3ef424561c6dc46 Mon Sep 17 00:00:00 2001 From: AaronA Date: Thu, 4 Jun 2015 14:47:16 -0600 Subject: [PATCH] Add the getting of a users favorites. --- lib/Twitter.js | 6 ++++++ test/spec/TwitterITSpec.js | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/Twitter.js b/lib/Twitter.js index 93c891f..4e39c04 100644 --- a/lib/Twitter.js +++ b/lib/Twitter.js @@ -95,6 +95,12 @@ Twitter.prototype.getHomeTimeline = function (params, error, success) { this.doRequest(url, error, success); }; +Twitter.prototype.getFavorites = function(params, error, success) { + var path = '/favorites/list.json' + this.buildQS(params); + var url = this.baseUrl + path; + this.doRequest(url, error, success); +}; + Twitter.prototype.getReTweetsOfMe = function (params, error, success) { var path = '/statuses/retweets_of_me.json' + this.buildQS(params); var url = this.baseUrl + path; diff --git a/test/spec/TwitterITSpec.js b/test/spec/TwitterITSpec.js index 20ddbaa..a6d6be3 100644 --- a/test/spec/TwitterITSpec.js +++ b/test/spec/TwitterITSpec.js @@ -43,6 +43,16 @@ describe('Twitter', function () { ); }); + it('should get favorites', function (done) { + var params = { count: '10'}; + twitter.getFavorites(params, error, + function (data) { + expect(JSON.parse(data).length).toEqual(10); + done(); + } + ); + }); + it('should get mentions timeline', function (done) { var params = { count: '10'}; twitter.getMentionsTimeline(params, error,