From 0736c8d398bfcdb9a5e08a18ffa181d1a3a912c9 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Wed, 28 Oct 2020 12:09:26 +0530 Subject: [PATCH] Lookup API: Change endpoint and response ...as requested by product. Signed-off-by: Prashanth Pai --- CHANGELOG.md | 3 +++ README.md | 3 +-- examples/lookup.js | 3 +-- lib/resources/lookup.js | 4 ++-- lib/rest/request-test.js | 6 +++--- package.json | 2 +- test/lookup.js | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb1bb1..8c59970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [4.11.0](https://github.com/plivo/plivo-node/releases/tag/v4.11.0)(2020-10-30) +- Change lookup API endpoint and response. + ## [4.10.0](https://github.com/plivo/plivo-node/releases/tag/v4.10.0)(2020-09-21) - Add Lookup API support. diff --git a/README.md b/README.md index c8dac9e..6e86df8 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,7 @@ let plivo = require('plivo'); let client = new plivo.Client('AUTH_ID', 'AUTH_TOKEN'); client.lookup.get( - "", - "carrier" // default type + "" ).then(function(response) { console.log(response); }).catch(function(error) { diff --git a/examples/lookup.js b/examples/lookup.js index 6a96b54..eeaa57c 100644 --- a/examples/lookup.js +++ b/examples/lookup.js @@ -2,8 +2,7 @@ let plivo = require('plivo'); let client = new plivo.Client('', ''); client.lookup.get( - "", - "carrier" // default info + "" ).then(function(response) { console.log(response); }).catch(function(error) { diff --git a/lib/resources/lookup.js b/lib/resources/lookup.js index 16f88ad..8d0139f 100644 --- a/lib/resources/lookup.js +++ b/lib/resources/lookup.js @@ -11,9 +11,9 @@ import { import * as _ from "lodash"; const clientKey = Symbol(); -const action = 'Lookup/Number/'; // unused as it is overridden, only for unit tests +const action = 'Number/'; // unused as it is overridden, only for unit tests const idField = 'OVERRIDDEN'; -const LOOKUP_API_BASE_URL = 'https://api.plivo.com/v1/Lookup/Number' +const LOOKUP_API_BASE_URL = 'https://lookup.plivo.com/v1/Number' export class Number extends PlivoResource { constructor(client, data = {}) { diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index 558e3e7..be2e21d 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -913,8 +913,8 @@ export function Request(config) { api_id: "930692a3-6f09-45b5-80f5-5585565fb30e", phone_number: "+14154305555", country: { - code_iso2: "US", - code_iso3: "USA", + iso2: "US", + iso3: "USA", name: "United States" }, format: { @@ -927,7 +927,7 @@ export function Request(config) { mobile_country_code: "310", mobile_network_code: "160", name: "Cingular Wireless", - ported: true, + ported: "yes", type: "mobile" }, resource_uri: "/v1/Lookup/Number/+14154305555?type=carrier" diff --git a/package.json b/package.json index 80fab58..c3c1fb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.10.0", + "version": "4.11.0", "description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML", "homepage": "https://github.com/plivo/plivo-node", "files": [ diff --git a/test/lookup.js b/test/lookup.js index d4f3c18..ec3ab3e 100644 --- a/test/lookup.js +++ b/test/lookup.js @@ -15,7 +15,7 @@ describe('LookupInterface', function() { .then(function(number) { assert.equal(number.numberFormat.e164, '+14154305555') assert.equal(number.phoneNumber, '+14154305555') - assert.equal(number.resourceUri, '/v1/Lookup/Number/+14154305555?type=carrier') + assert.equal(number.resourceUri, '/v1/Number/+14154305555?type=carrier') }) }); });