dizzydata
v1.0.2
Published
Dizzydata API client for Node.js
Downloads
3
Readme
Dizzydata API Client
Warning This package is still under development and the exposed methods are likely to change.
Installation
npm install --save dizzydata
Usage
var DizzydataClient = require('dizzydata')
var dizzydata = DizzydataClient({
server: 'https://api.dizzydata.com/',
credentials: {
username: '<YOUR USERNAME>',
password: '<YOUR PASSWORD>',
}
})
dizzydata.request({ method: 'GET', url: 'v1/jobs' })
.then(response => {
console.log('Received jobs', response.body)
}, error => {
console.error('Failed to load jobs')
})
Testing
You'll need to create a configuration file to run the tests. Some tests might fail for normal user accounts.
config/test-config.js
module.exports = {
dizzydata: {
URL: 'https://api.dizzydata.com/',
USERNAME: '<YOUR USERNAME>',
PASSWORD: '<YOUR PASSWORD>'
},
test: {
CLIENT_ID: '<YOUR CLIENT ID>'
}
};
Run the tests with:
NODE_ENV=test npm test
Changelog
0.4.0 -. 1.0.0
- The options have changed.
url
becameserver
,username
andpassword
are now under thecredentials
property. clients(options)
,updateClients(options)
,invoiceCount(options)
andadministrationCount(options)
have been removed. They were essentially light wrappers. You can do a better job wrapping Dizzydata requests because you know what information you need and how you want it.The old
request.authorized(options)is now
request(options)`.The old
request(options)is now
unauthorizedRequest(options)`.request(options)
now uses authorization by default and attempts to re-authorize automatically using the provided credentials.- Certificates have been removed. Our new certificates work out of the box.
- Much simpler implementation.
0.2.2 -> 0.3.1
The request wrapper was split from the lib/client.js to its own file. This caused some properties on the client to be located.
- The properties
username
,password
,baseUrl
,token
andresponseToJSON
are no longer available on the client objects. - The function
_request(options)
is now available throughrequest(options)
- The function
_authorizedRequest(options)
is now available throughrequest.authorized(options)
- The function
_requestToken()
is now available throughrequest._token()
but should for normal use not be called by you.