Add meta property to list responses

This commit is contained in:
Sreyanth 2018-01-09 22:36:59 +05:30
parent 4f85b61e31
commit bf5db4a5e6
4 changed files with 13 additions and 2 deletions

View file

@ -113,6 +113,7 @@ export class PlivoResourceInterface {
client('GET', action, params)
.then(response => {
let objects = [];
Object.defineProperty(objects, 'meta', {value: response.body.meta});
response.body.objects.forEach(item => {
objects.push(new Klass(client, item));
});
@ -141,4 +142,3 @@ export class PlivoResourceInterface {
}
}

View file

@ -30,6 +30,10 @@ export function Request(config) {
options.proxy = config.proxy;
}
if (typeof config.timeout !== 'undefined') {
options.timeout = config.timeout;
}
return new Promise((resolve, reject) => {
// LiveCall - needs to be at top
if (method === 'GET' && action === 'Call/6653422-91b6-4716-9fad-9463daaeeec2/' && params.status === 'live') {

View file

@ -20,6 +20,13 @@ describe('Application', function () {
})
});
it('has meta information', function () {
return client.applications.list()
.then(function(applications) {
assert.equal(applications.meta.total_count, 19)
})
});
it('should create application via interface', function () {
return client.applications.create('appName')
.then(function(application){

View file

@ -280,7 +280,7 @@ describe('calls', function () {
it('should get a livecall', function () {
return client.calls.getLiveCall('6653422-91b6-4716-9fad-9463daaeeec2')
.then(function (resp) {
console.log(resp);
// console.log(resp);
assert.equal(resp.callUuid, '6653422-91b6-4716-9fad-9463daaeeec2');
});
});