social-feed-api
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -52,5 +52,5 @@ 'use strict'; | ||
return new Promise(function (fulfill, reject) { | ||
return new Promise(function (fulfill) { | ||
(0, _request2.default)('https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=' + _this.data.appId + '&client_secret=' + _this.data.appSecret, function (error, response, body) { | ||
if (error) reject(error); | ||
if (error) fulfill({ error: error }); | ||
if (response.statusCode === 200) { | ||
@@ -57,0 +57,0 @@ _this.accessToken = JSON.parse(body).access_token; |
@@ -57,3 +57,3 @@ 'use strict'; | ||
if (this.data.accessToken !== null) return Promise.resolve(this.data.accessToken); | ||
return new Promise(function (fulfill, reject) { | ||
return new Promise(function (fulfill) { | ||
_request2.default.post('https://www.googleapis.com/oauth2/v4/token', { | ||
@@ -67,5 +67,5 @@ form: { | ||
} | ||
}, function (err, response, body) { | ||
if (err || response.statusCode >= 400) { | ||
reject(err || body); | ||
}, function (error, response, body) { | ||
if (error || response.statusCode >= 400) { | ||
fulfill({ error: error }); | ||
} else { | ||
@@ -72,0 +72,0 @@ fulfill(body); |
@@ -90,8 +90,7 @@ 'use strict'; | ||
var accessToken = token || this.data.accessToken; | ||
return new Promise(function (fulfill, reject) { | ||
(0, _request2.default)('https://api.instagram.com/v1/users/' + _this2.data.userId + '/media/recent/?access_token=' + accessToken, function (err, response, body) { | ||
if (err || response.statusCode >= 400) { | ||
reject({ | ||
source: 'instagram', | ||
error: err || body | ||
return new Promise(function (fulfill) { | ||
(0, _request2.default)('https://api.instagram.com/v1/users/' + _this2.data.userId + '/media/recent/?access_token=' + accessToken, function (error, response, body) { | ||
if (error || response.statusCode >= 400) { | ||
fulfill({ | ||
error: error | ||
}); | ||
@@ -98,0 +97,0 @@ } else { |
@@ -57,9 +57,11 @@ 'use strict'; | ||
return new Promise(function (fulfill, reject) { | ||
_this.client.get('statuses/user_timeline', { screen_name: _this.screenName, exclude_replies: _this.options.excludeReplies }, function (err, body, response) { | ||
if (err || response.statusCode >= 400) { | ||
reject({ | ||
source: 'twitter', | ||
error: err || body | ||
}); | ||
return new Promise(function (fulfill) { | ||
_this.client.get('statuses/user_timeline', { | ||
screen_name: _this.screenName, | ||
exclude_replies: Object.keys(_this.options).indexOf('excludeReplies') > -1 ? _this.options.excludeReplies : false, | ||
count: _this.options.count || 20, | ||
include_rts: Object.keys(_this.options).indexOf('includeRts') > -1 ? _this.options.includeRts : true | ||
}, function (error, body, response) { | ||
if (error || response.statusCode >= 400) { | ||
fulfill({ error: error }); | ||
} else { | ||
@@ -66,0 +68,0 @@ body.unshift({ |
@@ -64,4 +64,6 @@ 'use strict'; | ||
_this.instagram.initialize(code).then(function (res) { | ||
console.log(res); | ||
fulfill(res); | ||
}, function (err) { | ||
console.log(err); | ||
reject(err); | ||
@@ -68,0 +70,0 @@ }); |
{ | ||
"name": "social-feed-api", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Aggregates social media feeds and outputs them to use in an API", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
"gulp-babel": "^6.1.2", | ||
"mocha": "^3.2.0" | ||
"mocha": "^3.4.2" | ||
}, | ||
@@ -43,0 +43,0 @@ "dependencies": { |
@@ -81,3 +81,7 @@ # node-social-feed-api | ||
screenName: 'HANDLE_YOU_ARE_FETCHING', | ||
options: { excludeReplies: false }, | ||
options: { | ||
excludeReplies: true, | ||
count: 50, | ||
include_rts: false, | ||
}, | ||
}, | ||
@@ -151,3 +155,7 @@ instagram: { | ||
screenName: twitterScreenName, | ||
options: { excludeReplies: false }, | ||
options: { | ||
excludeReplies: true, | ||
count: 50, | ||
include_rts: false, | ||
}, | ||
}, | ||
@@ -154,0 +162,0 @@ instagram: { |
34939
637
220