Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4d19f59
Resolved issue.
patelravi Jan 12, 2019
3858a25
Resolved issue of message list
patelravi Jan 24, 2019
2ec504a
Finished create, list,get identity methods with test cases.
patelravi Jan 30, 2019
fe3eb6a
Mid commit.
patelravi Jan 31, 2019
f59cfc3
Resolving nsp issue.
patelravi Feb 4, 2019
f0993bf
Added node version to check logs.
patelravi Feb 5, 2019
e77e298
Merge branch 'master' of https://github.com/plivo/plivo-node into mes…
patelravi Feb 5, 2019
d52b14d
Added travis ci config file.
patelravi Feb 5, 2019
ccf35ea
Added permision for circle ci
patelravi Feb 5, 2019
7347071
Resolving circle ci issue.
patelravi Feb 5, 2019
6f81511
Modified circle ci configuration.
patelravi Feb 5, 2019
4d73cf4
Resolving circle ci config issue.
patelravi Feb 5, 2019
ac004f5
Resolving circle ci config issue.
patelravi Feb 5, 2019
cee782b
Resolving circle ci config issue.
patelravi Feb 5, 2019
4d14966
Resolving circle ci config issue.
patelravi Feb 5, 2019
f05a46c
Resolving circle ci config issue.
patelravi Feb 5, 2019
bd997ab
Resolving circle ci config issue.
patelravi Feb 5, 2019
c028a97
Resolving circle ci config issue.
patelravi Feb 5, 2019
d63354d
Resolving circle ci config issue.
patelravi Feb 5, 2019
10764f5
Resolving circle ci config issue.
patelravi Feb 5, 2019
f98c27f
Resolving circle ci config issue.
patelravi Feb 5, 2019
e2a9404
Resolving circle ci config issue.
patelravi Feb 5, 2019
9aa744f
Resolving circle ci config issue.
patelravi Feb 5, 2019
24e5e9a
Merge branch 'master' of https://github.com/plivo/plivo-node into acc…
patelravi Feb 6, 2019
d5282ef
Merge pull request #95 from patelravi/accented_chars_speak_issue
nixonsam Feb 6, 2019
49f8739
Bugfix: speak XML- accented characters to numeric expression.
Feb 6, 2019
c938b62
Merge pull request #105 from plivo/speakxml
Feb 6, 2019
9c217ce
Merge branch 'master' of https://github.com/patelravi/plivo-node into…
patelravi Feb 10, 2019
1cd8355
Finished address verification and identity verification.
patelravi Feb 10, 2019
c02971c
Added create address and identity test cases.
patelravi Feb 10, 2019
6375eb4
Merge branch 'master' of https://github.com/plivo/plivo-node into mes…
patelravi Feb 12, 2019
b8d2b11
Merge pull request #107 from patelravi/message_list_test
nixonsam Feb 12, 2019
e88961b
ADded addresses.js
patelravi Feb 17, 2019
45d29e1
Pulled from master.
patelravi Feb 17, 2019
8a3a77a
update and delete identity and address
patelravi Feb 17, 2019
2da213d
sink with master
patelravi Feb 17, 2019
ef16ce1
Syncing.
patelravi Feb 17, 2019
69eb312
Commited.
patelravi Feb 17, 2019
c08a03f
Finished address verification.
patelravi Feb 17, 2019
6001fe1
Finished changes for client.addresses
patelravi Feb 17, 2019
5630ca9
delete address
patelravi Feb 18, 2019
f51c510
Merged with master.
patelravi Feb 18, 2019
7e7399e
delete test cases done
patelravi Feb 18, 2019
2b1e0c0
delete identity added
patelravi Feb 18, 2019
3ff7582
Finished all test cases
patelravi Feb 18, 2019
b0dd515
Removed auth tokens.
patelravi Feb 18, 2019
5a75bd9
Pulled from beta.
patelravi Feb 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ gulp.task('pre-test', function () {
gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;

console.log('Running tests with node version', process.version);

gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({ reporter: 'spec' }))
Expand All @@ -62,6 +64,7 @@ gulp.task('watch', function () {

gulp.task('coveralls', ['test'], function () {
if (!process.env.CI) {
console.log('ignoring coveralls report generation.');
return;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class PlivoResource {
this[clientKey] = request;
}

update(params, id) {
update(params, id, requestConfig) {
let client = this[clientKey];
let action = this[actionKey];
let that = this;
id = typeof id !== 'undefined' ? id : that.id;

return new Promise((resolve, reject) => {
client('POST', action + id + '/', params)
client('POST', action + id + '/', params, requestConfig)
.then(response => {
extend(that, response.body);
extend(that, params);
Expand Down Expand Up @@ -125,13 +125,13 @@ export class PlivoResourceInterface {
});
}

create(params) {
create(params, requestConfig) {
let client = this[clientKey];
let idField = this[idKey];
let action = this[actionKey] + (this.id ? this.id + '/' : '');

return new Promise((resolve, reject) => {
client('POST', action, params)
client('POST', action, params, requestConfig)
.then(response => {
resolve(new PlivoGenericResponse(response.body, idField));
})
Expand Down
92 changes: 92 additions & 0 deletions lib/resources/addresses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { extend, validate } from '../utils/common.js';
import { PlivoResource, PlivoResourceInterface } from '../base';

const clientKey = Symbol();
const action = 'Verification/Address/';
const idField = 'id';

/* ---------------Address method----------*/
export class Address extends PlivoResource {
constructor(client, data = {}) {
super(action, Address, idField, client);
this[clientKey] = client;
if (idField in data) {
this.id = data[idField];
}

extend(this, data);
}
}

export class AddressInterface extends PlivoResourceInterface {
constructor(client, data = {}) {
super(action, Address, idField, client);
extend(this, data);
this[clientKey] = client;
}

get(id) {
let errors = validate([
{ field: 'id', value: id, validators: ['isRequired'] }
]);
if (errors) {
return errors;
}
return super.get(id);
}

list(params) {
return super.list(params, 'POST');
}

create(phone_number_country, number_type, salutation, first_name, last_name, address_line1, address_line2, city, region, postal_code, country_iso, callback_url, alias, file, proof_type, id_number, fiscal_identification_code, street_code, municipal_code) {
return super.create({
phone_number_country: phone_number_country,
number_type: number_type,
salutation: salutation,
first_name: first_name,
last_name: last_name,
address_line1: address_line1,
address_line2: address_line2,
city: city,
region: region,
postal_code: postal_code,
country_iso: country_iso,
callback_url: callback_url,
alias: alias,
file: file,
proof_type: proof_type,
id_number: id_number,
fiscal_identification_code: fiscal_identification_code,
street_code: street_code,
municipal_code: municipal_code
}, { isMultipart: true });
}

update(dataToUpdate) {

let errors = validate([
{ field: 'address_id', value: dataToUpdate.address_id, validators: ['isRequired'] }
]);

if (errors) {
return errors;
}

return (new Address(this[clientKey], {
id: dataToUpdate.address_id
})).update(dataToUpdate, this.id, { isMultipart: true });
}

delete(id) {
let errors = validate([
{ field: 'id', value: id, validators: ['isRequired'] }
]);

if (errors) {
return errors;
}

return (new Address(this[clientKey], { id: id })).delete(id);
}
}
92 changes: 92 additions & 0 deletions lib/resources/identities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { extend, validate } from '../utils/common.js';
import { PlivoResource, PlivoResourceInterface } from '../base';

const clientKey = Symbol();
const action = 'Verification/Identity/';
const idField = 'id';

/* ---------------Identity method----------*/
export class Identity extends PlivoResource {
constructor(client, data = {}) {
super(action, Identity, idField, client);
this[clientKey] = client;
if (idField in data) {
this.id = data[idField];
}

extend(this, data);
}
}

export class IdentityInterface extends PlivoResourceInterface {
constructor(client, data = {}) {
super(action, Identity, idField, client);
extend(this, data);
this[clientKey] = client;
}

get(id) {
let errors = validate([
{ field: 'id', value: id, validators: ['isRequired'] }
]);
if (errors) {
return errors;
}
return super.get(id);
}

list(params) {
return super.list(params, 'POST');
}

create(phone_number_country, number_type, salutation, first_name, last_name, address_line1, address_line2, city, region, postal_code, country_iso, callback_url, alias, file, proof_type, id_number, fiscal_identification_code, street_code, municipal_code) {
return super.create({
phone_number_country: phone_number_country,
number_type: number_type,
salutation: salutation,
first_name: first_name,
last_name: last_name,
address_line1: address_line1,
address_line2: address_line2,
city: city,
region: region,
postal_code: postal_code,
country_iso: country_iso,
callback_url: callback_url,
alias: alias,
file: file,
proof_type: proof_type,
id_number: id_number,
fiscal_identification_code: fiscal_identification_code,
street_code: street_code,
municipal_code: municipal_code
}, { isMultipart: true });
}

update(dataToUpdate) {

let errors = validate([
{ field: 'identity_id', value: dataToUpdate.identity_id, validators: ['isRequired'] }
]);

if (errors) {
return errors;
}

return (new Identity(this[clientKey], {
id: dataToUpdate.identity_id
})).update(dataToUpdate, this.id, { isMultipart: true });
}

delete(id) {
let errors = validate([
{ field: 'id', value: id, validators: ['isRequired'] }
]);

if (errors) {
return errors;
}

return (new Identity(this[clientKey], { id: id })).delete(id);
}
}
Loading