Ubivar node.js bindings
Ubivar prevents the risk of non-payment at the root and on autopilot for
businesses.
Quick Start
Install the nodejs binding of ubivar
from npm.
npm install ubivar
Initialize the binding with your API access token:
var Ubivar = require("ubivar")
, ubivar = new Ubivar("YOUR_API_ACCESS_TOKEN")
Send analytics event
ubivar.transactions.create({
"parameters" : {
"first_name": "John"
, "last_name" : "Doe"
}}, function(err, res){
if(err) return err
txId = res.data[0].id
})
ubivar.labels.retrieve(txId, function(err, res){
if(err) return err
data = res.data[0]
})
Resources, actions, and arguments
Every resource is accessed via your ubivar
instance and accepts an optional
callback as the last argument. In the matrix below we list the resources
(rows), the actions (columns) and the arguments (cells). The full documentation
is available at https://ubivar.com/docs/nodejs.
| Resource | C | R | U | D | L | Test Specs |
| ------------- |:-:|:-:|:-:|:-:|:----:|:-------:|:----------:|
| Me | |_ |{}
| | | |
| Events |{}
|id | {}
|id|{}
| |
- C: Create
- R: Retrieve
- U: Update
- D: Delete
- L: List
{}
: JSON with query parameters
Filter parameters
Filter | Default | Example | Description |
---|
start_after | | {"start_after":10} | id after the one specified |
end_before | | {"end_before":10} | id before the one specified |
limit | 10 | {"limit":10} | At most 10 returned results |
gt | | {"id":{"gt":10}} | id greater than 10 |
gte | | {"id":{"gte":10}} | id greater than or equal |
lt | | {"id":{"lt":10}} | id less than |
lte | | {"id":{"lte":10}} | id less than or equal |
Configuration
Extend this
ubivar
instance with a new resource whose accessibility is
controlled by access rights.
var Ubivar = require("ubivar")
, ubivar = new Ubivar("YOUR_API_ACCESS_TOKEN")
ubivar.extend("geoip")
Change API access token dynamically:
ubivar.set("auth", "your-api-token")
Define timeout of the binding:
ubivar.set("timeout", 20000)
Development
To run the tests, you will need a Ubivar test API key (from your Ubivar dashboard)
export UBIVAR_TEST_TOKEN="your-test-api-key"
npm install -g mocha
npm test
Note: on Windows, use SET
instead of export
for setting the UBIVAR_TEST_TOKEN
environment variable.
Author
Originally inspired from stripe-node. Developed and maintained by Fabrice Colas (fabrice.colas@gmail.com) for Ubivar.