find optionally accepts a plain filter string e.g. AmountDue > 1000 AND DueDate > DateTime(1970-1-1) and handles encoding and appending to Xero API path.
findOne accepts a Xero ID e.g. xero.Invoices.findOne('foobar, callback) executes Xero.call with a path of /Invoices/foobar
Helper methods
Helper methods can be found on Xero.helpers. Have initially implemented dateToXeroDateTimeString(date) which accepts a Date object and returns a string as expected by the Xero API e.g. DateTime(2015-5-26)
What is not included
More work is required for conditional endpoint methods i.e. there is no check for whether an endpoint accepts an id in GET requests so all endpoints receive the findOne method regardless.
Need to implement save method.
Tests
npm test validates that the methods forward API calls to Xero.call
npm run test-xero-api validates method integration with Xero API. Requires keys as outlined in L7-8 of test/xero-api.js
Endpoint methods
Xero[endpoint].find
Xero[endpoint].findOne
find
optionally accepts a plain filter string e.g.AmountDue > 1000 AND DueDate > DateTime(1970-1-1)
and handles encoding and appending to Xero API path.findOne
accepts a Xero ID e.g.xero.Invoices.findOne('foobar, callback)
executesXero.call
with a path of/Invoices/foobar
Helper methods
Xero.helpers
. Have initially implementeddateToXeroDateTimeString(date)
which accepts a Date object and returns a string as expected by the Xero API e.g.DateTime(2015-5-26)
What is not included
More work is required for conditional endpoint methods i.e. there is no check for whether an endpoint accepts an id in GET requests so all endpoints receive the
findOne
method regardless.Need to implement
save
method.Tests
npm test
validates that the methods forward API calls toXero.call
npm run test-xero-api
validates method integration with Xero API. Requires keys as outlined in L7-8 oftest/xero-api.js
Cheers!