public function testUpdateByProfileId()
 {
     $client = new NextCallerClient(null, null, true);
     $data = json_decode(self::JSON_DATA, true);
     $response = $client->updateByProfileId(self::PROFILE_ID, $data);
     $this->assertEquals($response, null);
 }
 public function testGetByNameAddress()
 {
     $nameAddressData = array('first_name' => 'Jerry', 'last_name' => 'Seinfeld', 'address' => '129 West 81st Street', 'city' => 'New York', 'state' => 'NY', 'zip_code' => '10024');
     $client = new NextCallerClient(null, null, true);
     $profiles = $client->getByNameAddress($nameAddressData);
     $this->assertEquals($profiles, json_decode(self::JSON_RESPONSE, true));
 }
 public static function setUpBeforeClass()
 {
     $client = new NextCallerClient(null, null, true);
     $mocker = new \Guzzle\Plugin\Mock\MockPlugin();
     $mocker->addResponse(new \Guzzle\Http\Message\Response(200, array(), self::JSON_RESPONSE));
     $client->addSubscriber($mocker);
     self::$client = $client;
     self::$mock = $mocker;
 }
 public function testNotValid()
 {
     $client = new NextCallerClient(null, null, true);
     try {
         $client->updateByProfileId(self::PROFILE_ID, array('email' => 'XXXXXXXXXXXX'));
     } catch (BadResponseException $expected) {
         $this->assertEquals(400, $expected->getResponse()->getStatusCode());
         $this->assertEquals(422, $expected->getCode());
         return;
     }
     $this->fail('An expected exception has not been raised.');
 }
 public static function setUpBeforeClass()
 {
     $client = new NextCallerClient(null, null, true);
     $mocker = new \Guzzle\Plugin\Mock\MockPlugin();
     $mocker->addResponse(new \Guzzle\Http\Message\Response(404, array(), '{"error": {"message": "Resource hasn\'t been found .", "code": "404", "type": "Bad Request"}}'));
     $mocker->addResponse(new \Guzzle\Http\Message\Response(400, array(), '{"error": {"message": "The profile id you have entered is invalid. Please ensure your profile id contains 30 symbols.", "code": "558", "type": "Bad Request"}}'));
     $mocker->addResponse(new \Guzzle\Http\Message\Response(400, array(), '{"error": {"message": "Validation Error", "code": "422", "type": "Unprocessable Entity", "description": {"email": ["Invalid email address"]}}}'));
     $mocker->addResponse(new \Guzzle\Http\Message\Response(429, array('X-Rate-Limit-Limit' => '7', 'X-Rate-Limit-Remaining' => '0', 'X-Rate-Limit-Reset' => '1441286043'), '{"error": {"message": "API calls per second limit is exceeded.", "code": "1061", "type": "Too Many Requests"}}'));
     $client->addSubscriber($mocker);
     self::$client = $client;
     self::$mock = $mocker;
 }
<?php

require __DIR__ . '/vendor/autoload.php';
use NextCaller\NextCallerClient;
$user = "";
$password = "";
$id = "c7c17736128033c92771b7f33fead7";
$sandbox = true;
$client = new NextCallerClient($user, $password, $sandbox);
try {
    $profile = $client->getByProfileId($id);
    /* array(
            'id' => 'c7c17736128033c92771b7f33fead7',
            'first_name' => 'James',
            'middle_name' => '',
            'last_name' => 'Johnson',
            'name' => 'James Johnson',
            'language' => 'English',
            'phone' => array(
                array(
                    'number' => '2125558345',
                    'resource_uri' => '/v2/records/2125558345/',
                )
    
            ),
            'carrier' => 'Allied Wireless Communication Llc Dba Alltel - Sc',
            'address' => array(
                array(
                    'city' => 'Orangeburg',
                    'extended_zip' => '5320',
                    'country' => 'USA',
<?php

require __DIR__ . '/vendor/autoload.php';
use NextCaller\NextCallerClient;
$user = "";
$password = "";
$nameAddressData = array('first_name' => 'Jerry', 'last_name' => 'Seinfeld', 'address' => '129 West 81st Street', 'city' => 'New York', 'state' => 'NY', 'zip_code' => '10024');
$sandbox = false;
$client = new NextCallerClient($user, $password, $sandbox);
try {
    $records = $client->getByNameAddress($nameAddressData);
    /* array(
            'id' => '97d949a413f4ea8b85e9586e1f2d9a',
            'first_name' => 'Jerry',
            'middle_name' => 'Allen',
            'last_name' => 'Seinfeld',
            'name' => 'Jerry Allen Seinfeld',
            'language' => 'English',
            'phone' => array(
                array(
                    'number' => '2125558383',
                    'resource_uri' => '/v2/records/2125558383/',
                )
            ),
            'carrier' => 'Verizon Wireless',
            'line_type' => 'Mobile',
            'address' => array(
                array(
                    'city' => 'New York',
                    'extended_zip' => '2344',
                    'country' => 'USA',
<?php

require __DIR__ . '/vendor/autoload.php';
use NextCaller\NextCallerClient;
$user = "";
$password = "";
$id = "c7c17736128033c92771b7f33fead7";
$phone = '6925558386';
$accountId = 'user1';
$sandbox = true;
$client = new NextCallerClient($user, $password, $sandbox);
try {
    $fraudLevel = $client->getFraudLevel($phone, $accountId);
    /*
    array(
        'spoofed' => 'unknown',
        'fraud_risk' => 'medium'
    );
    */
    var_dump($fraudLevel);
} catch (\NextCaller\Exception\RateLimitException $e) {
    var_dump($e->getRateLimit());
    var_dump($e->getResetTime());
} catch (\NextCaller\Exception\BadResponseException $e) {
    // Example
    // 555
    var_dump($e->getCode());
    // The number you have entered is invalid. Please ensure your number contains 10 digits.
    var_dump($e->getMessage());
    /* array(
     *      "message" => "The number you have entered is invalid. Please ensure your number contains 10 digits.",
 public function testGetByPhone()
 {
     $client = new NextCallerClient(null, null, true);
     $profiles = $client->getByPhone(self::PROFILE_PHONE);
     $this->assertEquals($profiles, json_decode(self::JSON_RESPONSE, true));
 }
<?php

require __DIR__ . '/vendor/autoload.php';
use NextCaller\NextCallerClient;
$user = "";
$password = "";
$id = "c7c17736128033c92771b7f33fead7";
$sandbox = true;
$data = array("email" => 'xxx');
$client = new NextCallerClient($user, $password, $sandbox);
try {
    $client->updateByProfileId($id, $data);
} catch (\NextCaller\Exception\RateLimitException $e) {
    var_dump($e->getRateLimit());
    var_dump($e->getResetTime());
} catch (\NextCaller\Exception\BadResponseException $e) {
    // Example
    // 422
    var_dump($e->getCode());
    // Validation Error
    var_dump($e->getMessage());
    /*
     array(
        'message' => 'Validation Error',
        'code' => '422',
        'type' => 'Unprocessable Entity',
        'description' => array(
            'email' => array('Invalid email address')
        )
    );
    */
<?php

require __DIR__ . '/vendor/autoload.php';
use NextCaller\NextCallerClient;
$user = "";
$password = "";
$phoneNumber = "6925558386";
$sandbox = true;
$client = new NextCallerClient($user, $password, $sandbox);
try {
    $records = $client->getByPhone($phoneNumber);
    /*
        array(
            'records' => array(
                array(
                    'id' => '68293d3f87db2c4ee97545add4bc67',
                    'first_name' => 'Dawn',
                    'middle_name' => 'E',
                    'last_name' => 'Brady',
                    'name' => 'Dawn E Brady',
                    'language' => 'English',
                    'phone' => array(
                        array(
                            'number' => '6925558386',
                            'resource_uri' => '/v2/records/6925558386/'
                        )
                    ),
                    'carrier' => 'Verizon Wireless',
                    'address' => array(
                        array(
                            'city' => 'San Juan Capistrano',