fanburst-api
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -9,23 +9,30 @@ 'use strict'; | ||
opts = opts || {}; | ||
this.credentials = opts.credentials || {}; | ||
var _this = this; | ||
this.credentials = opts.credentials ? opts.credentials : {}; | ||
this.baseUrl = opts.baseUrl || 'https://api.fanburst.com'; | ||
var | ||
credentials = {}, | ||
keysClientId = ['clientid', 'client_id', 'clientID', 'clientId'], | ||
keysClientSecret = ['clientsecret', 'client_secret', 'clientSecret'], | ||
keysCallbacks = ['callbackurl', 'callback_url', 'callbackUrl', 'callbackURL', 'redirecturi', 'redirectUri', 'redirect_uri'], | ||
keysCredentials = [keysClientId, keysClientSecret, keysCallbacks]; | ||
objCredentials = { | ||
clientId: keysClientId, | ||
clientSecret: keysClientSecret, | ||
redirect_uri: keysCallbacks | ||
}; | ||
keysCredentials.forEach(function(arrKeys) { | ||
arrKeys.forEach(function(key) { | ||
for (var keyCredential in objCredentials) { | ||
objCredentials[keyCredential].forEach(function(key) { | ||
if (opts[key]) { | ||
credentials.clientId = opts[key]; | ||
_this.credentials[keyCredential] = opts[key]; | ||
} | ||
if (opts.credentials[key]) { | ||
credentials.clientId = opts.credentials[key]; | ||
if (_this.credentials[key]) { | ||
_this.credentials[keyCredential] = _this.credentials[key]; | ||
} | ||
}); | ||
}); | ||
} | ||
console.log('this', this); | ||
} | ||
@@ -32,0 +39,0 @@ |
{ | ||
"name": "fanburst-api", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Fanburst Api for Node.js", | ||
@@ -23,10 +23,12 @@ "keywords": [ | ||
"author": { | ||
"name" : "Igor Shabanov", | ||
"name": "Igor Shabanov", | ||
"email": "shabanovtg@gmail.com", | ||
"url" : "http://shabanovtg.ru" | ||
"url": "http://shabanovtg.ru" | ||
}, | ||
"licenses": [ { | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/MIT" | ||
} ], | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/MIT" | ||
} | ||
], | ||
"dependencies": { | ||
@@ -33,0 +35,0 @@ "request-promise": "^3.0.0" |
@@ -17,3 +17,4 @@ # fanburst-api | ||
``` | ||
var FanburstApi = require('fanburst-api')(); | ||
var FanburstApi = require('fanburst-api'); | ||
var fanburstApi = new FanburstApi(); | ||
``` | ||
@@ -24,3 +25,3 @@ | ||
``` | ||
FanburstApi.me(accessToken, function(err, result) { | ||
fanburstApi.me(accessToken, function(err, result) { | ||
if (err) { | ||
@@ -39,3 +40,3 @@ //... | ||
``` | ||
FanburstApi.followingContains(followingId, accessToken, function(err, result) { | ||
fanburstApi.followingContains(followingId, accessToken, function(err, result) { | ||
if (err) { | ||
@@ -52,3 +53,3 @@ //... | ||
``` | ||
FanburstApi.followingAdd(followingId, accessToken, function(err, result) { | ||
fanburstApi.followingAdd(followingId, accessToken, function(err, result) { | ||
if (err) { | ||
@@ -55,0 +56,0 @@ //... |
9689
152
58