public function testUserResolveRequest()
 {
     $Client = new Client(111, 222);
     $Request = $Client->userResolve('333', '*****@*****.**', '127.0.0.1');
     $this->assertEquals(['project' => '111', 'identifier' => '333', 'email' => '*****@*****.**', 'ip' => '127.0.0.1', 'signature' => 'bdf79a4f0b5113097efdbc3764cb3e53538a2b20034dbe95f69be66441101f8d'], $this->getRequestParametersProperty($Request));
     $Request = $Client->userResolve('333', '*****@*****.**', '127.0.0.1', 'Alexey Maslov');
     $this->assertEquals(['project' => '111', 'identifier' => '333', 'email' => '*****@*****.**', 'ip' => '127.0.0.1', 'display_name' => 'Alexey Maslov', 'signature' => '95bd008f5e65770d48ad2c6fc41b2484987894524bf9cff872260a22cb7fbed1'], $this->getRequestParametersProperty($Request));
     $Request = $Client->userResolve('333', '*****@*****.**', '127.0.0.1', 'Alexey Maslov', 'ru');
     $this->assertEquals(['project' => '111', 'identifier' => '333', 'email' => '*****@*****.**', 'ip' => '127.0.0.1', 'display_name' => 'Alexey Maslov', 'locale' => 'ru', 'signature' => 'ecdf063b7e9294f095ffb408e9ea95f417f15a882d3e2ffb5f11836d3c3ba3a5'], $this->getRequestParametersProperty($Request));
     $Request = $Client->userResolve('333', '*****@*****.**', '127.0.0.1', 'Alexey Maslov', 'ru', '+12345678');
     $this->assertEquals(['project' => '111', 'identifier' => '333', 'email' => '*****@*****.**', 'ip' => '127.0.0.1', 'display_name' => 'Alexey Maslov', 'locale' => 'ru', 'phone' => '+12345678', 'signature' => '737c903a6f72d8e088a324daa1e572dd7bd1b30e06f61482ea0dbbc390c7c4dd'], $this->getRequestParametersProperty($Request));
 }
Example #2
0
    $displayName = (string) $value;
});
$Command->appendParameter(new Option('email', 'e', 'user email address', Option::TYPE_STRING, true), function ($name, $value) use(&$email) {
    $email = (string) $value;
});
$Command->appendParameter(new Option('ip', 'i', 'user ip address', Option::TYPE_STRING, true), function ($name, $value) use(&$ip) {
    $ip = (string) $value;
});
$Command->appendParameter(new Option('locale', 'l', 'user\'s locale (ISO 639-1)', Option::TYPE_STRING), function ($name, $value) use(&$locale) {
    $locale = (string) $value;
});
$Command->appendParameter(new Option('phone', 'p', 'user\'s phone number', Option::TYPE_STRING), function ($name, $value) use(&$phone) {
    $phone = (string) $value;
});
$Command->appendParameter(new Option('private', 'r', 'project private key', Option::TYPE_STRING, true), function ($name, $value) use(&$privateKey) {
    $privateKey = (string) $value;
});
$Command->appendParameter(new Option('public', 'b', 'project public key', Option::TYPE_STRING, true), function ($name, $value) use(&$publicKey) {
    $publicKey = (string) $value;
});
$Command->appendParameter(new Option('user', 'u', 'user unique unchangeable identifier', Option::TYPE_STRING, true), function ($name, $value) use(&$user) {
    $user = (string) $value;
});
try {
    $Command->parse(true);
    $Client = new Client($publicKey, $privateKey);
    $Response = $Client->userResolve($user, $email, $ip, $displayName, $locale, $phone)->execute();
    printf("%s\n", $Response);
} catch (RequiredOptionException $Ex) {
    $Command->displayHelp();
}