diff --git a/README.md b/README.md index 4404dcc..6d8ffa1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,11 @@ Do cool stuff: ```javascript var api = require('infusionsoft-api'); -var infusionsoft = new api.DataContext('myapp', 'MY_API_KEY'); +var infusionsoft = new api.DataContext( + { + url: 'https://api.infusionsoft.com/crm/xmlrpc', + headers: {Authorization: `Bearer ${access_token}`} + }); infusionsoft.Contacts .where(Contact.FirstName, 'Brandon') diff --git a/lib/DataContext.js b/lib/DataContext.js index 66f0661..a3ceb13 100644 --- a/lib/DataContext.js +++ b/lib/DataContext.js @@ -16,12 +16,9 @@ module.exports = DataContext = typedef // of the services. .class('DataContext') .define({ - __constructor__: function(appName, apiKey) + __constructor__: function(options) { - this.appName = appName; - this.apiKey = apiKey; - this.client = xmlrpc.createSecureClient( - 'https://' + this.appName + '.infusionsoft.com/api/xmlrpc'); + this.client = xmlrpc.createSecureClient(options); this._setupServices(); this._setupTables();