producteca-sdk
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -20,2 +20,3 @@ (function() { | ||
this._convertDeprecatedToNew = __bind(this._convertDeprecatedToNew, this); | ||
this._convertJsonToProduct = __bind(this._convertJsonToProduct, this); | ||
this._convertJsonToProducts = __bind(this._convertJsonToProducts, this); | ||
@@ -38,7 +39,3 @@ this._findOne = __bind(this._findOne, this); | ||
ProductsApi.prototype.get = function(id) { | ||
return (this.respond(this.client.getAsync("/products/" + id))).then((function(_this) { | ||
return function(json) { | ||
return new Product(_this._convertDeprecatedToNew(json)); | ||
}; | ||
})(this)); | ||
return (this.respond(this.client.getAsync("/products/" + id))).then(this._convertJsonToProduct); | ||
}; | ||
@@ -62,4 +59,4 @@ | ||
ProductsApi.prototype.findByVariationSku = function(sku, $select) { | ||
return this._findOne("variations/any(variation variation/barcode eq '" + sku + "')", $select)["catch"]((function(_this) { | ||
ProductsApi.prototype.findByVariationSku = function(sku) { | ||
return (this.respond(this.client.getAsync("/products/bysku/" + sku))).then(this._convertJsonToProduct)["catch"]((function(_this) { | ||
return function() { | ||
@@ -136,3 +133,3 @@ throw new Error("The product with sku=" + sku + " wasn't found"); | ||
firstMatch = _.first(products); | ||
return new Product(_this._convertDeprecatedToNew(firstMatch)); | ||
return _this._convertJsonToProduct(firstMatch); | ||
}; | ||
@@ -143,9 +140,9 @@ })(this)); | ||
ProductsApi.prototype._convertJsonToProducts = function(products) { | ||
return products.map((function(_this) { | ||
return function(it) { | ||
return new Product(_this._convertDeprecatedToNew(it)); | ||
}; | ||
})(this)); | ||
return products.map(this._convertJsonToProduct); | ||
}; | ||
ProductsApi.prototype._convertJsonToProduct = function(json) { | ||
return new Product(this._convertDeprecatedToNew(json)); | ||
}; | ||
ProductsApi.prototype._convertDeprecatedToNew = function(product) { | ||
@@ -152,0 +149,0 @@ var _ref; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"main": "build/sdk.js", | ||
@@ -18,2 +18,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"chai-as-promised": "^5.2.0", | ||
"coffee-script": "^1.8.0", | ||
@@ -20,0 +21,0 @@ "grunt": "~0.4.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47148
10
543