producteca-sdk
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -22,3 +22,3 @@ (function() { | ||
this._convertJsonToProducts = __bind(this._convertJsonToProducts, this); | ||
this._findOne = __bind(this._findOne, this); | ||
this._findMany = __bind(this._findMany, this); | ||
this._getProductsPageByPage = __bind(this._getProductsPageByPage, this); | ||
@@ -51,7 +51,3 @@ this.update = __bind(this.update, this); | ||
ProductsApi.prototype.findByCode = function(code, $select) { | ||
return this._findOne("sku eq '" + code + "'", $select)["catch"]((function(_this) { | ||
return function() { | ||
throw new Error("The product with code=" + code + " wasn't found"); | ||
}; | ||
})(this)); | ||
return this._findMany("sku eq '" + code + "'", $select); | ||
}; | ||
@@ -112,3 +108,3 @@ | ||
ProductsApi.prototype._findOne = function($filter, $select) { | ||
ProductsApi.prototype._findMany = function($filter, $select) { | ||
var query; | ||
@@ -122,12 +118,3 @@ if ($select == null) { | ||
} | ||
return (this.respondMany(this.client.getAsync("/products/" + query))).then((function(_this) { | ||
return function(products) { | ||
var firstMatch; | ||
if (_.isEmpty(products)) { | ||
throw new Error("product not found"); | ||
} | ||
firstMatch = _.first(products); | ||
return _this._convertJsonToProduct(firstMatch); | ||
}; | ||
})(this)); | ||
return (this.respondMany(this.client.getAsync("/products/" + query))).then(this._convertJsonToProducts); | ||
}; | ||
@@ -134,0 +121,0 @@ |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"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
46520
530