0.0.7 • Published 8 years ago

siftscience v0.0.7

Weekly downloads
44
License
MIT
Repository
github
Last release
8 years ago

Sift Science

Sift Science NodeJS Client

Install

Using npm:

$ npm install siftscience

Usage

import SiftScience from 'siftscience';
const siftScience = new SiftScience(API_KEY);

Once you initilize the client, you can start send events to Sift Science.

Features

  • Events API
    • createOrder
    • updateOrder
    • transaction
    • createAccount
    • updateAccount
    • createContent
    • updateContent
    • contentStatus
    • flagContent
    • addPromotion
    • addItemToCart
    • removeItemFromCart
    • submitReview
    • sendMessage
    • login
    • logout
    • linkSessionToUser
    • chargeback
    • orderStatus
  • Score API
    • getScore

Events API

siftScience.events.[eventName](data, options)

Parameters:

  • data: Data to send to Sift Science
  • options - options.return_score: boolean

Return:

  • Promise - Result from Sift Science

Example

siftScience.events.createAccount(
	{ $user_id: userId, $session_id: sessionId },
	{ return_score: true }
	)
	.then((res) => {
        console.log(res);
    });

Score API

siftScience.getScore(userId)

Parameters:

  • userId: The user ID

Return:

  • Promise - Result from Sift Science

Example

siftScience.getScore(userId)
	.then((res) => {
        console.log(res);
    });

Contribute

Gulp TasksDescription
gulp lintRuns eslint on your source code and tests.
gulp babelTranspile your source code, outputting into the dist/
gulp testRun your mocha test you'll add to test/ out putting the result to the your console, great for running the tests locally.
gulp test-ciSame as test, except it outputs the results in junit format to the test-results.xml. Mainly when running the tests on a CI server, or if your feeling frisky.
gulp buildRun lint, test & babel in sequence, so you can check the full process runnitng smooth.
gulp build-ciRuns lint, test-ci & babel. Main command in the circle-ci config.
Cheers, -Team BookMD

alt text

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago