mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-05 06:12:31 -06:00
test powerpack
This commit is contained in:
parent
e60d5d927a
commit
470433a784
1 changed files with 25 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import * as _ from 'lodash';
|
||||
|
||||
import {
|
||||
PlivoGenericResponse,
|
||||
PlivoResource,
|
||||
PlivoResourceInterface
|
||||
} from '../base';
|
||||
|
|
@ -695,8 +696,30 @@ export class PowerpackInterface extends PlivoResourceInterface {
|
|||
* @promise {object} return {@link Powerpack} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(uuid) {
|
||||
return super.get(uuid);
|
||||
get(uuid) {
|
||||
let errors = validate([{
|
||||
field: 'uuid',
|
||||
value: uuid,
|
||||
validators: ['isRequired']
|
||||
}]);
|
||||
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
if (action !== '' && !uuid) {
|
||||
reject(new Error(this[idKey] + ' must be set'));
|
||||
}
|
||||
client('GET', action + (uuid ? uuid + '/' : ''))
|
||||
.then(response => {
|
||||
resolve(new PlivoGenericResponse(response.body, client));
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* create Powerpack
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue