infusionsoft
Advanced tools
Comparing version 0.3.1 to 0.3.2
15
index.js
@@ -8,3 +8,3 @@ var xmlrpc = require('xmlrpc'); | ||
this.apiKey = apikey; | ||
this.responseHandler = handler; | ||
this.responseHandler = handler || function () {}; | ||
this.client = xmlrpc.createSecureClient('https://' + this.appName + '.infusionsoft.com/api/xmlrpc'); | ||
@@ -15,6 +15,4 @@ | ||
iSDK.prototype.methodCaller = function (service, data, callback) { | ||
var cb = (typeof(callback) === 'function') ? callback : function(){}; | ||
this.client.methodCall(service, data, function(error, value){ | ||
cb(error, value); | ||
}); | ||
var cb = (typeof(callback) === 'function') ? callback : this.responseHandler; | ||
this.client.methodCall(service, data, cb); | ||
}; | ||
@@ -63,6 +61,11 @@ | ||
iSDK.prototype.grpRemove = function (cId, gId, callback) { | ||
ca = [this.apiKey, cId, gId]; | ||
var ca = [this.apiKey, cId, gId]; | ||
this.methodCaller('ContactService.removeFromGroup', ca, callback); | ||
}; | ||
iSDK.prototype.mergeCon = function (cId, dupId, callback) { | ||
var ca = [this.apiKey, cId, dupId]; | ||
this.methodCaller('ContactService.merge', ca, callback); | ||
}; | ||
iSDK.prototype.optIn = function (email, reason, callback) { | ||
@@ -69,0 +72,0 @@ var ca = [this.apiKey, email, reason || 'API opt-in']; |
{ | ||
"name": "infusionsoft", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "InfusionSoft node.js SDK", | ||
@@ -5,0 +5,0 @@ "contributors": [{ "name": "Patrick Lodder", "email": "plodder@intellibiz.org" }], |
@@ -8,3 +8,3 @@ infusionsoft | ||
[![Travis](https://travis-ci.org/patricklodder/infusionsoft.png)](https://travis-ci.org/patricklodder/infusionsoft) | ||
[![Travis](https://travis-ci.org/patricklodder/infusionsoft.png)](https://travis-ci.org/patricklodder/infusionsoft) [![Dependency Status](https://david-dm.org/patricklodder/infusionsoft.png?theme=shields.io)](https://david-dm.org/patricklodder/infusionsoft) | ||
@@ -19,3 +19,3 @@ ### Installation ### | ||
var iSDK = require('infusionsoft'); | ||
var client = new iSDK('app_name', 'api_key); | ||
var client = new iSDK('app_name', 'api_key'); | ||
``` | ||
@@ -52,2 +52,4 @@ | ||
**ContactService.merge**: ```client.mergeCon(contactId, duplicateId, callback)``` | ||
**ContactService.removeFromGroup**: ```client.grpRemove(contactId, groupId, callback)``` | ||
@@ -54,0 +56,0 @@ |
@@ -210,2 +210,8 @@ var vows = require('vows'); | ||
"must match xml": assertXml('optStatus_call') | ||
}, | ||
"mergeCon": { | ||
topic: function (isdk) { | ||
isdk.mergeCon(1, 13, this.callback); | ||
}, | ||
"must match xml": assertXml('mergeCon_call') | ||
} | ||
@@ -212,0 +218,0 @@ } |
31651
40
392
95