Skip to content

Commit

Permalink
Merge pull request #4 from jordanwalsh23/master
Browse files Browse the repository at this point in the history
Updates to readme and fix minor bugs
  • Loading branch information
jordanwalsh23 authored Mar 23, 2017
2 parents f64e6f4 + c0adcbc commit ca750aa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,20 @@ The following features are provided:
* Support for Private, Public, and Partner applications (look at sample_app/index.js for 3 stage support)


# Installation
# Usage

$ npm install xero-node --save
This package will eventually be deployed to npm, but until then you can clone and run, or install as follows:

Edit your package.json and manually include this as a dependency:

```javascript
"dependencies": {
...
"xero-node": "XeroAPI/xero-node"
},
```

This will pull the latest branch from GitHub and use this within your code.

### External Config

Expand Down
13 changes: 7 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports.PrivateApplication = require('./application').PrivateApplication;
module.exports.PublicApplication = require('./application').PublicApplication;
module.exports.PartnerApplication = require('./application').PartnerApplication;

module.exports.setLogLevel = function(logLevel, toConsole) {
logLevel = logLevel || "error";
toConsole = toConsole || false;
logger.config({ level: logLevel, toConsole: toConsole });
};

function init(options) {
logger.config({ level: options.log.level, toConsole: options.log.toConsole });
_.mixin({
Expand All @@ -28,9 +34,4 @@ function init(options) {
})
}

/**
* Change the log level here to affect the whole application.
* This should be externalised so the consumer can define it.
*/

init({ log: { level: 'debug', toConsole: false } });
init({ log: { level: 'error', toConsole: false } });
8 changes: 6 additions & 2 deletions test/accountingtests.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ process.on('uncaughtException', function(err) {
console.log('uncaught', err)
})

//Change the log level
xero.setLogLevel('warn');

var currentApp;
var eventReceiver;
var organisationCountry = '';
Expand Down Expand Up @@ -45,6 +48,8 @@ before('init instance and set options', function(done) {

eventReceiver = currentApp.eventEmitter;



done();
})

Expand Down Expand Up @@ -1052,7 +1057,7 @@ describe('regression tests', function() {

var myInvoice = invoices[0];
var myContact = myInvoice.Contact;
var myCreditNoteAmount = myInvoice.Total / 2; //50% of total invoice
var myCreditNoteAmount = myInvoice.AmountDue / 2; //50% of total amount left

//Create the credit note.
var creditNoteData = {
Expand Down Expand Up @@ -2108,7 +2113,6 @@ describe('regression tests', function() {
expect(contact.ContactID).to.equal(sampleContact.ContactID);
contact.getAttachments()
.then(function(attachments) {
console.log(attachments);
done();
})
.catch(function(err) {
Expand Down

0 comments on commit ca750aa

Please sign in to comment.