diff --git a/lib/resources/powerpacks.js b/lib/resources/powerpacks.js index ff69586..13eba76 100644 --- a/lib/resources/powerpacks.js +++ b/lib/resources/powerpacks.js @@ -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