producteca-sdk
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -23,16 +23,16 @@ (function() { | ||
this._getProductsPageByPage = __bind(this._getProductsPageByPage, this); | ||
this.updateProduct = __bind(this.updateProduct, this); | ||
this.update = __bind(this.update, this); | ||
this.updateVariationPictures = __bind(this.updateVariationPictures, this); | ||
this.updateVariationStocks = __bind(this.updateVariationStocks, this); | ||
this.createVariations = __bind(this.createVariations, this); | ||
this.createProduct = __bind(this.createProduct, this); | ||
this.findProductByVariationSku = __bind(this.findProductByVariationSku, this); | ||
this.findProductByCode = __bind(this.findProductByCode, this); | ||
this.getMultipleProducts = __bind(this.getMultipleProducts, this); | ||
this.getProducts = __bind(this.getProducts, this); | ||
this.getProduct = __bind(this.getProduct, this); | ||
this.create = __bind(this.create, this); | ||
this.findByVariationSku = __bind(this.findByVariationSku, this); | ||
this.findByCode = __bind(this.findByCode, this); | ||
this.getMany = __bind(this.getMany, this); | ||
this.getAll = __bind(this.getAll, this); | ||
this.get = __bind(this.get, this); | ||
return ProductsApi.__super__.constructor.apply(this, arguments); | ||
} | ||
ProductsApi.prototype.getProduct = function(id) { | ||
ProductsApi.prototype.get = function(id) { | ||
return (this.respond(this.client.getAsync("/products/" + id))).then((function(_this) { | ||
@@ -45,11 +45,11 @@ return function(json) { | ||
ProductsApi.prototype.getProducts = function() { | ||
ProductsApi.prototype.getAll = function() { | ||
return this._getProductsPageByPage().then(this._convertJsonToProducts); | ||
}; | ||
ProductsApi.prototype.getMultipleProducts = function(ids) { | ||
ProductsApi.prototype.getMany = function(ids) { | ||
return this.respond(this.client.getAsync("/products?ids=" + ids)).then(this._convertJsonToProducts); | ||
}; | ||
ProductsApi.prototype.findProductByCode = function(code) { | ||
ProductsApi.prototype.findByCode = function(code) { | ||
return this._findOne("sku eq '" + code + "'")["catch"]((function(_this) { | ||
@@ -62,3 +62,3 @@ return function() { | ||
ProductsApi.prototype.findProductByVariationSku = function(sku) { | ||
ProductsApi.prototype.findByVariationSku = function(sku) { | ||
return this._findOne("variations/any(variation variation/barcode eq '" + sku + "')")["catch"]((function(_this) { | ||
@@ -71,3 +71,3 @@ return function() { | ||
ProductsApi.prototype.createProduct = function(product) { | ||
ProductsApi.prototype.create = function(product) { | ||
return this.respond(this.client.postAsync("/products", this._convertNewToDeprecated(product))); | ||
@@ -97,3 +97,3 @@ }; | ||
ProductsApi.prototype.updateProduct = function(id, update) { | ||
ProductsApi.prototype.update = function(id, update) { | ||
return this.respond(this.client.putAsync("/products/" + id, this._convertNewToDeprecated(update))); | ||
@@ -100,0 +100,0 @@ }; |
@@ -22,6 +22,6 @@ (function() { | ||
this.getShipment = __bind(this.getShipment, this); | ||
this.updateSalesOrder = __bind(this.updateSalesOrder, this); | ||
this.getSalesOrderAndFullProducts = __bind(this.getSalesOrderAndFullProducts, this); | ||
this.getSalesOrder = __bind(this.getSalesOrder, this); | ||
this.getSalesOrders = __bind(this.getSalesOrders, this); | ||
this.update = __bind(this.update, this); | ||
this.getWithFullProducts = __bind(this.getWithFullProducts, this); | ||
this.get = __bind(this.get, this); | ||
this.getAll = __bind(this.getAll, this); | ||
this.productsApi = new ProductsApi(endpoint); | ||
@@ -31,3 +31,3 @@ SalesOrdersApi.__super__.constructor.call(this, endpoint); | ||
SalesOrdersApi.prototype.getSalesOrders = function(filters) { | ||
SalesOrdersApi.prototype.getAll = function(filters) { | ||
var querystring; | ||
@@ -41,12 +41,12 @@ if (filters == null) { | ||
SalesOrdersApi.prototype.getSalesOrder = function(id) { | ||
SalesOrdersApi.prototype.get = function(id) { | ||
return this.respond(this.client.getAsync("/salesorders/" + id)); | ||
}; | ||
SalesOrdersApi.prototype.getSalesOrderAndFullProducts = function(id) { | ||
return this.getSalesOrder(id).then((function(_this) { | ||
SalesOrdersApi.prototype.getWithFullProducts = function(id) { | ||
return this.get(id).then((function(_this) { | ||
return function(salesOrder) { | ||
var productIds; | ||
productIds = _.map(salesOrder.lines, "product.id").join(","); | ||
return _this.productsApi.getMultipleProducts(productIds).then(function(products) { | ||
return _this.productsApi.getMany(productIds).then(function(products) { | ||
return { | ||
@@ -61,3 +61,3 @@ salesOrder: salesOrder, | ||
SalesOrdersApi.prototype.updateSalesOrder = function(id, update) { | ||
SalesOrdersApi.prototype.update = function(id, update) { | ||
return this.respond(this.client.putAsync("/salesorders/" + id, update)); | ||
@@ -64,0 +64,0 @@ }; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "build/sdk.js", | ||
@@ -11,0 +11,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45839
27
544