diff --git a/README.md b/README.md index c894a80..beeb27d 100644 --- a/README.md +++ b/README.md @@ -292,7 +292,7 @@ In the example above, the API will be called with `customerId = 20234245`. suiteAPI.segment.listContacts(payload); -##### List contacts +##### List segments suiteAPI.segment.listSegments(payload); diff --git a/api/endpoints/segment/index.js b/api/endpoints/segment/index.js index 4265e76..49d5407 100644 --- a/api/endpoints/segment/index.js +++ b/api/endpoints/segment/index.js @@ -16,7 +16,7 @@ util.inherits(Segment, Base); _.extend(Segment.prototype, { listContacts: function(payload, options) { - return this._requireParameters(payload, ['segment_id']).then(function() { + return this._requireParameters(payload, ['segment_id', 'limit']).then(function() { var url = util.format('/filter/%s/contacts', payload.segment_id); logger.log('segment_list_contacts'); diff --git a/api/endpoints/segment/index.spec.js b/api/endpoints/segment/index.spec.js index a4b8228..c22e10e 100644 --- a/api/endpoints/segment/index.spec.js +++ b/api/endpoints/segment/index.spec.js @@ -12,8 +12,9 @@ describe('SuiteAPI Segment endpoint', function() { describe('#listContacts', function() { testApiMethod(SegmentAPI, 'listContacts').withArgs({ - segment_id: 10 - }).shouldGetResultFromEndpoint('/filter/10/contacts'); + segment_id: 10, + limit: 100 + }).shouldGetResultFromEndpoint('/filter/10/contacts/?limit=100'); testApiMethod(SegmentAPI, 'listContacts').withArgs({ segment_id: 10, @@ -21,7 +22,9 @@ describe('SuiteAPI Segment endpoint', function() { offset: 0 }).shouldGetResultFromEndpoint('/filter/10/contacts/?limit=100&offset=0'); - testApiMethod(SegmentAPI, 'listContacts').withArgs({}).shouldThrowMissingParameterError('segment_id'); + testApiMethod(SegmentAPI, 'listContacts').withArgs({ limit: 100 }).shouldThrowMissingParameterError('segment_id'); + + testApiMethod(SegmentAPI, 'listContacts').withArgs({ segment_id: 10 }).shouldThrowMissingParameterError('limit'); }); });