producteca-sdk
Advanced tools
Comparing version 7.8.3 to 8.0.0
@@ -28,5 +28,6 @@ (function() { | ||
ContactsApi.prototype.getByIntegration = function(app, integrationId) { | ||
return this.client.getAsync("/contacts", { | ||
return this.client.getAsync("/contacts/byintegration", { | ||
qs: { | ||
$filter: "profile/integrationId eq '" + integrationId + "'&profile/app eq " + app | ||
integrationId: integrationId, | ||
app: app | ||
} | ||
@@ -33,0 +34,0 @@ }); |
@@ -22,3 +22,3 @@ (function() { | ||
ProductecaApi.prototype.initializeClients = function(endpoint) { | ||
endpoint.url = endpoint.url || "http://api.producteca.com"; | ||
endpoint.url = endpoint.url || "http://apps.producteca.com/api"; | ||
this.client = new Client(endpoint.url, this._buildAuthMethod(endpoint)); | ||
@@ -25,0 +25,0 @@ return this.asyncClient = new Client(this._makeUrlAsync(endpoint.url, this._buildAuthMethod(endpoint))); |
@@ -20,3 +20,2 @@ (function() { | ||
this._findMany = bind(this._findMany, this); | ||
this.getSkus = bind(this.getSkus, this); | ||
this.getWarehouses = bind(this.getWarehouses, this); | ||
@@ -29,3 +28,2 @@ this.getPricelists = bind(this.getPricelists, this); | ||
this.updateAttributes = bind(this.updateAttributes, this); | ||
this.simpleUpdate = bind(this.simpleUpdate, this); | ||
this.updatePrices = bind(this.updatePrices, this); | ||
@@ -46,3 +44,2 @@ this.updateVariationPictures = bind(this.updateVariationPictures, this); | ||
this.getMany = bind(this.getMany, this); | ||
this.getAll = bind(this.getAll, this); | ||
this.get = bind(this.get, this); | ||
@@ -57,8 +54,4 @@ this.resource = "products"; | ||
ProductsApi.prototype.getAll = function() { | ||
return this._getPageByPage().then(this._convertJsonToProducts); | ||
}; | ||
ProductsApi.prototype.getMany = function(ids) { | ||
return this._findMany("/products", { | ||
return this._findMany("/products/multi", { | ||
ids: ids | ||
@@ -91,3 +84,5 @@ }); | ||
ProductsApi.prototype.findByVariationIntegrationId = function(integrationId, $select) { | ||
return this._findMany("/products/byvariationintegration/" + integrationId, {}, $select); | ||
return this._findMany("/products/byvariationintegration", { | ||
integrationId: integrationId | ||
}, $select); | ||
}; | ||
@@ -170,6 +165,2 @@ | ||
ProductsApi.prototype.simpleUpdate = function(id, update) { | ||
return this.client.putAsync("/products/" + id + "/simple", update); | ||
}; | ||
ProductsApi.prototype.updateAttributes = function(id, update) { | ||
@@ -205,15 +196,2 @@ return this.client.putAsync("/products/" + id + "/attributes", update); | ||
ProductsApi.prototype.getSkus = function(skip, top, moreQueryString) { | ||
if (skip == null) { | ||
skip = 0; | ||
} | ||
if (top == null) { | ||
top = 20; | ||
} | ||
if (moreQueryString == null) { | ||
moreQueryString = ""; | ||
} | ||
return this.client.getAsync("/products/skus?$top=" + top + "&$skip=" + skip + "&" + moreQueryString); | ||
}; | ||
ProductsApi.prototype._findMany = function(url, qs, $select) { | ||
@@ -220,0 +198,0 @@ if (qs == null) { |
@@ -17,3 +17,2 @@ (function() { | ||
function SalesOrdersApi(endpoint) { | ||
this._buildSalesOrdersFilters = bind(this._buildSalesOrdersFilters, this); | ||
this.salesOrderCreated = bind(this.salesOrderCreated, this); | ||
@@ -34,7 +33,5 @@ this.deletePayment = bind(this.deletePayment, this); | ||
this.getWithFullProducts = bind(this.getWithFullProducts, this); | ||
this._findSalesOrder = bind(this._findSalesOrder, this); | ||
this.getByInvoiceIntegration = bind(this.getByInvoiceIntegration, this); | ||
this.getByIntegration = bind(this.getByIntegration, this); | ||
this.get = bind(this.get, this); | ||
this.getAll = bind(this.getAll, this); | ||
this.resource = "salesorders"; | ||
@@ -45,11 +42,2 @@ this.productsApi = new ProductsApi(endpoint); | ||
SalesOrdersApi.prototype.getAll = function(filters) { | ||
var querystring; | ||
if (filters == null) { | ||
filters = {}; | ||
} | ||
querystring = this._buildSalesOrdersFilters(filters); | ||
return this._getPageByPage(0, "$filter=" + querystring); | ||
}; | ||
SalesOrdersApi.prototype.get = function(id, opts) { | ||
@@ -62,6 +50,11 @@ return this.client.getAsync("/salesorders/" + id, opts); | ||
integrationId = arg.integrationId, app = arg.app; | ||
qs = overrideApp ? { | ||
app: overrideApp | ||
} : void 0; | ||
return this.client.getAsync("/integrations/" + app + "/salesorders/" + integrationId, { | ||
qs = { | ||
integrationId: integrationId | ||
}; | ||
if (overrideApp) { | ||
_.assign(qs, { | ||
app: overrideApp | ||
}); | ||
} | ||
return this.client.getAsync("/salesorders/byintegration", { | ||
qs: qs | ||
@@ -72,22 +65,13 @@ }); | ||
SalesOrdersApi.prototype.getByInvoiceIntegration = function(arg) { | ||
var app, invoiceIntegrationId, propertiesNotFound, query; | ||
var app, invoiceIntegrationId, qs; | ||
invoiceIntegrationId = arg.invoiceIntegrationId, app = arg.app; | ||
query = "invoiceIntegration/integrationId eq " + invoiceIntegrationId + " and invoiceIntegration/app eq " + app + ")"; | ||
propertiesNotFound = "invoiceIntegrationId: " + invoiceIntegrationId + " and app: " + app; | ||
return this._findSalesOrder(query, propertiesNotFound); | ||
qs = { | ||
integrationId: invoiceIntegrationId, | ||
app: app | ||
}; | ||
return this.client.getAsync("/salesorders/byinvoiceintegration", { | ||
qs: qs | ||
}); | ||
}; | ||
SalesOrdersApi.prototype._findSalesOrder = function(query, propertiesNotFound) { | ||
var oDataQuery; | ||
oDataQuery = encodeURIComponent(query); | ||
return (this.respondMany(this.client.getAsync("/salesorders/?$filter=" + oDataQuery))).then((function(_this) { | ||
return function(results) { | ||
if (_.isEmpty(results)) { | ||
throw new Error("The sales orders with " + propertiesNotFound + " wasn't found."); | ||
} | ||
return _.first(results); | ||
}; | ||
})(this)); | ||
}; | ||
SalesOrdersApi.prototype.getWithFullProducts = function(id) { | ||
@@ -164,29 +148,2 @@ return this.get(id).then((function(_this) { | ||
SalesOrdersApi.prototype._buildSalesOrdersFilters = function(filters) { | ||
var addAnd, brandsFilter, querystring; | ||
querystring = "(IsOpen eq true) and (IsCanceled eq false)"; | ||
addAnd = (function(_this) { | ||
return function(condition) { | ||
return querystring += " and (" + condition + ")"; | ||
}; | ||
})(this); | ||
brandsFilter = (function(_this) { | ||
return function(brandIds) { | ||
return brandIds.map(function(id) { | ||
return "(Lines/any(line:line/Variation/Definition/Brand/Id eq " + id + "))"; | ||
}).join(" or "); | ||
}; | ||
})(this); | ||
if (filters.paid != null) { | ||
addAnd("PaymentStatus eq 'Approved'"); | ||
} | ||
if (filters.brands != null) { | ||
addAnd(brandsFilter(filters.brands)); | ||
} | ||
if (filters.other != null) { | ||
addAnd(filters.other); | ||
} | ||
return encodeURIComponent(querystring); | ||
}; | ||
return SalesOrdersApi; | ||
@@ -193,0 +150,0 @@ |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "7.8.3", | ||
"version": "8.0.0", | ||
"main": "build/sdk.js", | ||
@@ -11,0 +11,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
73291
0
811