Skip to content

Commit b82256f

Browse files
author
Jenkins User
committed
Merge commit 'a8950914483cf2e650fe259521c6037676235abc'
2 parents 4003999 + a895091 commit b82256f

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

examples/product-variations.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*!
2+
* This basic example shows how to update product variations
3+
*
4+
* It starts by fetching the first deal from the
5+
* account, it then fetches 10 updates of this deal.
6+
*
7+
* Usage:
8+
* node product-variations.js APITOKEN
9+
**/
10+
11+
if (!process.argv[2]) {
12+
process.stderr.write('Please provide API token!' + "\n");
13+
process.exit();
14+
}
15+
16+
var Pipedrive = require(__dirname + '/../index');
17+
var pipedrive = new Pipedrive.Client(process.argv[2]);
18+
var _ = require('lodash');
19+
20+
pipedrive.Products.getAll({start: 0, limit: 10}, function (error, data, additionalData, req, res, relatedObjects) {
21+
var product = _.first(data);
22+
product.updateVariation({
23+
id: product.product_variations[0].id,
24+
name: 'argentum',
25+
prices: [
26+
{
27+
price: 444,
28+
cost: 333,
29+
currency: 'USD'
30+
}
31+
]
32+
}, function (err, data) {
33+
console.log(err);
34+
console.log(data);
35+
});
36+
});

lib/blueprint.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ exports.apiRelatedObjects = {
7373
'deals'
7474
],
7575
'products': [
76-
'deals'
76+
'deals',
77+
'variations'
7778
],
7879
'users': [
7980
'activities',
@@ -107,7 +108,8 @@ exports.timelineableObjects = ['deals'];
107108
exports.editableSubItems = {
108109
'deals': ['products', 'followers', 'participants'],
109110
'organizations': ['followers'],
110-
'persons': ['followers']
111+
'persons': ['followers'],
112+
'products': ['variations']
111113
};
112114

113115
// Main object types that support merging action via the API.

0 commit comments

Comments
 (0)