Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lookup API support #186

Merged
merged 2 commits into from
Oct 7, 2020
Merged

Add Lookup API support #186

merged 2 commits into from
Oct 7, 2020

Conversation

ppai-plivo
Copy link
Contributor

@ppai-plivo ppai-plivo commented Sep 14, 2020

Sample program:

<?php
require 'vendor/autoload.php';
use Plivo\RestClient;
 
$client = new RestClient("XXXX", "XXXX");

try {
    $response = $client->lookup->get("+14154305555", "carrier");
    var_dump($response);
} catch (PlivoRestException $ex) {
    print_r(ex);
}
array(6) {
  ["api_id"]=>
  string(36) "f7e4956f-7ab6-4f27-9e95-4c96b2ec4325"
  ["phone_number"]=>
  string(12) "+14154305555"
  ["country"]=>
  array(3) {
    ["name"]=>
    string(13) "United States"
    ["code_iso2"]=>
    string(2) "US"
    ["code_iso3"]=>
    string(3) "USA"
  }
  ["format"]=>
  array(4) {
    ["e164"]=>
    string(12) "+14154305555"
    ["national"]=>
    string(14) "(415) 430-5555"
    ["international"]=>
    string(15) "+1 415-430-5555"
    ["rfc3966"]=>
    string(19) "tel:+1-415-430-5555"
  }
  ["carrier"]=>
  array(5) {
    ["mobile_country_code"]=>
    string(3) "310"
    ["mobile_network_code"]=>
    string(3) "150"
    ["name"]=>
    string(17) "Cingular Wireless"
    ["type"]=>
    string(6) "mobile"
    ["ported"]=>
    bool(true)
  }
  ["resource_uri"]=>
  string(43) "/v1/Lookup/Number/+14154305555?type=carrier"
}

@ppai-plivo
Copy link
Contributor Author

ppai-plivo commented Sep 14, 2020

Unit test:

$ ./vendor/bin/phpunit --debug tests/Resources/LookupTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

Test 'Plivo\Tests\Resources\LookupTest::testLookupGet' started
Test 'Plivo\Tests\Resources\LookupTest::testLookupGet' ended


Time: 30 ms, Memory: 4.00 MB

OK (1 test, 3 assertions)

Signed-off-by: Prashanth Pai <[email protected]>
...as per inputs from product.

Signed-off-by: Prashanth Pai <[email protected]>
@nixonsam nixonsam merged commit 64f9401 into master Oct 7, 2020
@nixonsam nixonsam deleted the ppai-lookup-api branch October 7, 2020 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants