Comparing version 0.0.11 to 0.0.12
@@ -24,2 +24,3 @@ (function() { | ||
this._doRequest = __bind(this._doRequest, this); | ||
this.adaptSalesOrder = __bind(this.adaptSalesOrder, this); | ||
this.createOutputBean = __bind(this.createOutputBean, this); | ||
@@ -75,17 +76,16 @@ this.getStocks = __bind(this.getStocks, this); | ||
AlmexApi.prototype.createOutputBean = function(order, options) { | ||
var adapt, outputBean, request; | ||
var outputBeanXml, request; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
outputBean = this.ordersAdapter.getOutputBean(order); | ||
outputBeanXml = this.adaptSalesOrder(order); | ||
request = this.requests.createOutputBean; | ||
adapt = (function(_this) { | ||
return function(xml) { | ||
return new XmlBuilder(xml).buildWith(outputBean); | ||
}; | ||
})(this); | ||
if (options.log != null) { | ||
console.log(adapt(request.xml)); | ||
console.log(outputBeanXml); | ||
} | ||
return this._doRequest(request, adapt).spread((function(_this) { | ||
return this._doRequest(request, (function(_this) { | ||
return function() { | ||
return outputBeanXml; | ||
}; | ||
})(this)).spread((function(_this) { | ||
return function(response) { | ||
@@ -104,2 +104,13 @@ return xml2js.parseStringAsync(response.body).then(function(xml) { | ||
/* | ||
Get the xml of an order. | ||
*/ | ||
AlmexApi.prototype.adaptSalesOrder = function(order) { | ||
var outputBean; | ||
outputBean = this.ordersAdapter.getOutputBean(order); | ||
return new XmlBuilder(this.requests.createOutputBean).buildWith(outputBean); | ||
}; | ||
AlmexApi.prototype._doRequest = function(request, adapt) { | ||
@@ -106,0 +117,0 @@ var params; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "build/almexApi.js", | ||
@@ -11,0 +11,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
22398
222