From 3d5ce99b0413b88e31b6a3307d00813e237241b4 Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Wed, 4 Feb 2015 11:37:39 -0500 Subject: [PATCH] js2xmlparser --- lib/recurly.js | 30 +++++++++++++++--------------- package.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/recurly.js b/lib/recurly.js index 81e4cce..132827c 100644 --- a/lib/recurly.js +++ b/lib/recurly.js @@ -1,5 +1,5 @@ (function(){ - var Js2xml = require('js2xml').Js2Xml, + var js2xmlparser = require('js2xmlparser'), Client = require('./client'), utils = require('./utils'), router = require('./routes/'); @@ -17,10 +17,10 @@ t.request(utils.addParams(routes.accounts.get, {account_code: accountcode}), callback); }, create: function(details, callback){ - t.request(routes.accounts.create, callback, new Js2xml('account',details).toString()); + t.request(routes.accounts.create, callback, js2xmlparser('account',details)); }, update: function(accountcode, details, callback){ - t.request(utils.addParams(routes.accounts.update, {account_code: accountcode}), callback, new Js2xml('account', details).toString()); + t.request(utils.addParams(routes.accounts.update, {account_code: accountcode}), callback, js2xmlparser('account', details)); }, close: function(accountcode, callback){ t.request(utils.addParams(routes.accounts.close, {account_code: accountcode}), callback); @@ -35,7 +35,7 @@ t.request(utils.addParams(routes.adjustments.get, {account_code: accountcode}), callback); }, create: function(accountcode, details, callback){ - t.request(utils.addParams(routes.adjustments.create, {account_code: accountcode}), callback, new Js2xml('adjustment',details).toString()); + t.request(utils.addParams(routes.adjustments.create, {account_code: accountcode}), callback, js2xmlparser('adjustment',details)); }, remove: function(uuid, callback){ t.request(utils.addParams(routes.adjustments.remove, {uuid: uuid}), callback); @@ -45,7 +45,7 @@ //http://docs.recurly.com/api/billing-info this.billingInfo = { update: function(accountcode, details, callback){ - t.request(utils.addParams(routes.billingInfo.update, {account_code: accountcode} ), callback, new Js2xml('billing_info', details).toString()); + t.request(utils.addParams(routes.billingInfo.update, {account_code: accountcode} ), callback, js2xmlparser('billing_info', details)); }, get: function(accountcode, callback){ t.request(utils.addParams(routes.billingInfo.get, {account_code: accountcode} ), callback); @@ -64,7 +64,7 @@ t.request(utils.addParams(routes.coupons.get, {coupon_code: couponcode}), callback); }, create: function(details, callback){ - t.request(routes.coupons.create, callback, new Js2xml('coupon', details).toString()); + t.request(routes.coupons.create, callback, js2xmlparser('coupon', details)); }, deactivate: function(couponcode, callback){ t.request(utils.addParams(routes.coupons.deactivate, {coupon_code: couponcode}), callback); @@ -73,7 +73,7 @@ this.couponRedemption = { redeem: function(couponcode, details, callback){ - t.request(utils.addParams(routes.couponRedemption.redeem, {coupon_code: couponcode}), callback, new Js2xml('redemption', details).toString()); + t.request(utils.addParams(routes.couponRedemption.redeem, {coupon_code: couponcode}), callback, js2xmlparser('redemption', details)); }, get: function(accountcode, callback){ t.request(utils.addParams(routes.couponRedemption.get, {account_code: accountcode}), callback); @@ -101,7 +101,7 @@ t.request(utils.addParams(routes.invoices.get, {invoice_number: invoicenumber}), callback); }, create: function(accountcode, details, callback){ - t.request(utils.addParams(routes.invoices.create, {account_code: accountcode}), callback, new Js2xml('invoice', details).toString()); + t.request(utils.addParams(routes.invoices.create, {account_code: accountcode}), callback, js2xmlparser('invoice', details)); }, markSuccessful: function(invoicenumber, callback){ t.request(utils.addParams(routes.invoices.markSuccessful, {invoice_number: invoicenumber}), callback); @@ -119,10 +119,10 @@ t.request(utils.addParams(routes.plans.get, {plan_code: plancode}), callback); }, create: function(details, callback){ - t.request(routes.plans.create, callback, new Js2xml('plan', details).toString()); + t.request(routes.plans.create, callback, js2xmlparser('plan', details)); }, update: function(plancode, details, callback){ - t.request(utils.addParams(routes.plans.update, {plan_code: plancode}), callback, new Js2xml('plan', details).toString()); + t.request(utils.addParams(routes.plans.update, {plan_code: plancode}), callback, js2xmlparser('plan', details)); }, remove: function(plancode, callback){ t.request(utils.addParams(routes.plans.remove, {plan_code: plancode}), callback); @@ -137,7 +137,7 @@ t.request(utils.addParams(routes.planAddons.get, {plan_code: plancode, addon_code: addoncode}), callback); }, create: function(plancode, details, callback){ - t.request(utils.addParams(routes.planAddons.create, {plan_code: plancode}), callback, new Js2xml('add_on', details).toString()); + t.request(utils.addParams(routes.planAddons.create, {plan_code: plancode}), callback, js2xmlparser('add_on', details)); }, update: function(plancode, addoncode, details, callback){ t.request(utils.addParams( @@ -145,7 +145,7 @@ { plan_code: plancode, add_on_code: addoncode }), - callback, new Js2xml('add_on', details).toString()); + callback, js2xmlparser('add_on', details)); }, remove: function(plancode, addoncode, callback){ t.request(utils.addParams(routes.planAddons.remove, {plan_code: plancode, add_on_code: addoncode}), callback); @@ -164,10 +164,10 @@ t.request(utils.addParams(routes.subscriptions.get, {uuid: uuid}), callback); }, create: function(details, callback){ - t.request(routes.subscriptions.create, callback, new Js2xml('subscription', details).toString()); + t.request(routes.subscriptions.create, callback, js2xmlparser('subscription', details)); }, update: function(uuid, details, callback){ - t.request(utils.addParams(routes.subscriptions.update, {uuid: uuid}), callback, new Js2xml('subscription', details).toString()); + t.request(utils.addParams(routes.subscriptions.update, {uuid: uuid}), callback, js2xmlparser('subscription', details)); }, cancel: function(uuid, callback){ t.request(utils.addParams(routes.subscriptions.cancel, {uuid: uuid}), callback); @@ -197,7 +197,7 @@ t.request(utils.addParams(routes.transactions.get, {'id': id}), callback); }, create: function(details, callback){ - t.request(routes.transactions.create, callback, new Js2xml('transaction', details).toString()); + t.request(routes.transactions.create, callback, js2xmlparser('transaction', details)); }, refund: function(id, callback, amount){ var route = utils.addParams(routes.transactions.refund, {id: id}); diff --git a/package.json b/package.json index d869925..3cf3ed8 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ , "main" : "./lib/recurly.js" , "dependencies" : { "xml2js": ">= 0.4.0", - "js2xml": "valorkin/js2xml" + "js2xmlparser": "0.1.7" } , "engines" : { "node" : ">= 0.4" } }