Skip to content

Commit 081d934

Browse files
author
Jenkins User
committed
Merge commit 'eebdcacb310ce2a744c4789f089484746fc63328'
2 parents 018fdc7 + eebdcac commit 081d934

File tree

6 files changed

+1
-305
lines changed

6 files changed

+1
-305
lines changed

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,6 @@ pipedrive.Filters.getAll({ type: 'deals' }, function(filtersListErr, filtersList
228228
});
229229
```
230230

231-
# Ad hoc data change event listeneres (beta)
232-
233-
The API client lets you create event listeners to specific data changes in your Pipedrive account. This is very similar to Webhooks, except the listeners are bound on an ad hoc basis and will only be executed during the lifecycle of your application. For example (see below) you may want to execute a callback every time a new deal is added to Pipedrive. Note that this callback will execute not only when you create the deal through this API client but regardless of where the deal was added from — a mobile app, the web app or through the Pipedrive API by some other integration.
234-
235-
```js
236-
var Pipedrive = require('pipedrive');
237-
var pipedrive = new Pipedrive.Client('PUT_YOUR_API_TOKEN_HERE', { strictMode: true });
238-
239-
pipedrive.on('deal.added', function(event, data) {
240-
console.log('A deal was added! ' + data.current.title + ' (' + data.current.value + ' ' + data.current.currency + ')');
241-
});
242-
```
243-
244-
Supported event names consist of object type (deal, person, organization, ...) and type of change (`added`, `deleted`, `updated` or `merged`), joined by a dot. The list of supported object types are listed in the [Pipedrive Webhooks documentation](https://app.pipedrive.com/webhooks).
245-
246-
To read more about ad hoc data change event listeners, check out [examples/live-updates.js](examples/live-updates.js).
247-
248231
# API Documentation
249232

250233
The Pipedrive REST API documentation can be found at https://developers.pipedrive.com/v1

examples/live-updates.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

lib/Pipedrive.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
var _ = require('lodash'),
1313
blueprint = require(__dirname + '/blueprint'),
1414
inflection = require(__dirname + '/inflection'),
15-
Channel = require(__dirname + '/channel'),
1615
log = require(__dirname + '/log'),
1716
RestHandlers = require(__dirname + '/restHandlers'),
1817
Collection = require(__dirname + '/Collection'),
@@ -35,15 +34,7 @@
3534
options = _.extend({}, defaults, options);
3635
options.strictMode = !!options.strictMode;
3736

38-
var that = this,
39-
listener = new Channel(apiToken);
40-
41-
if (options.strictMode) {
42-
// in strict mode, we'll expose the EventEmitter-like real-time integration methods
43-
this.on = listener.on;
44-
this.removeListener = listener.removeListener;
45-
this.removeAllListeners = listener.removeAllListeners;
46-
}
37+
var that = this;
4738

4839
_.each(blueprint.apiObjects, function (item) {
4940
that[item.substr(0, 1).toUpperCase() + item.substr(1)] = new Collection(item, _.extend({}, options, {apiToken: apiToken}));

lib/channel.js

Lines changed: 0 additions & 181 deletions
This file was deleted.

test/integration/client.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,6 @@ describe('client', function () {
1717
strictClient = new Pipedrive.Client(API_TOKEN, {strictMode: true});
1818
});
1919

20-
21-
describe('client.on()', function () {
22-
it('should allow event binding to connect and deal adding', function (done) {
23-
this.timeout(10000);
24-
25-
var deal = {title: 'Client-nodejs - .on() test', value: 10000, currency: 'EUR'};
26-
27-
strictClient.on('connect', function () {
28-
strictClient.Deals.add(deal, function (error, result) {
29-
deal.id = result.id;
30-
});
31-
});
32-
33-
strictClient.on('deal.added', function (event, data) {
34-
assert.equal(data.current.title, deal.title);
35-
assert.equal(data.current.value, deal.value);
36-
assert.equal(data.current.currency, deal.currency);
37-
38-
strictClient.removeAllListeners();
39-
40-
//cleanup
41-
strictClient.Deals.remove(deal.id, function () {
42-
done();
43-
});
44-
});
45-
});
46-
});
47-
4820
describe('collection.getAll()', function () {
4921
it('should list filters and deals', function (done) {
5022
client.Filters.getAll({type: 'deals'}, function (filtersListErr, filtersList) {

test/unit/client.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ describe('client module', function () {
1919
});
2020
});
2121

22-
describe('client.on()', function () {
23-
it('should be defined in strict mode', function () {
24-
assert.isFunction(strictClient.on);
25-
});
26-
27-
it('should not be defined in regular mode', function () {
28-
assert.isUndefined(client.on);
29-
});
30-
});
31-
3222
it('client.getAll() should throw error if non-existant resource is requested', function (done) {
3323
client.getAll('bananas', function (error) {
3424
assert.equal(error.message, 'bananas is not supported object type for getAll()');

0 commit comments

Comments
 (0)