-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
632 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const Promise = require('bluebird'); | ||
const v204HttpClient = require('./v204HttpClient'); | ||
const _ = require('lodash'); | ||
|
||
function getDecisionsApi(siftScienceClient) { | ||
const key = siftScienceClient._key; | ||
const logger = siftScienceClient._logger; | ||
|
||
return { | ||
/** | ||
* @param {Object} [data] | ||
* @param {Object} [params] | ||
* https://siftscience.com/developers/docs/curl/score-api/score-api | ||
*/ | ||
getByUserId(userId, params = {}) { | ||
if (!userId) return Promise.reject(new Error('userId is required')); | ||
|
||
_.extend(params, { | ||
$api_key: key | ||
}); | ||
|
||
return Promise.resolve(v204HttpClient.get(`/users/${userId}/score`, { | ||
params | ||
})) | ||
.then(response => response.data) | ||
.catch(error => logger.logRequestError(error)); | ||
} | ||
}; | ||
} | ||
|
||
module.exports = getDecisionsApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const HttpClient = require('./httpClient'); | ||
|
||
const V204_BASE_URL = 'https://api.siftscience.com/v204'; | ||
|
||
module.exports = new HttpClient(V204_BASE_URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const HttpClient = require('./httpClient'); | ||
|
||
const V3_BASE_URL = 'https://api.siftscience.com/v3'; | ||
|
||
module.exports = new HttpClient(V3_BASE_URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.