update() public method

Updates an identity
public update ( string $identity, string $label = null, string $master = null, string $status = null ) : mixed
$identity string
$label string
$master string
$status string
return mixed
示例#1
0
 /**
  * @dataProvider updateProvider
  * @covers Datasift_Account_Identity::update
  */
 public function testUpdate($identityId, $label, $master, $status, $apiResult, $expectedResult)
 {
     $identity = new DataSift_Account_Identity($this->_user);
     DataSift_MockApiClient::setResponse($apiResult);
     if (isset($expectedResult['error'])) {
         $this->setExpectedException('DataSift_Exception_APIError');
     }
     $result = $identity->update($identityId, $label, $master, $status);
     $this->assertEquals($expectedResult, $result);
 }
示例#2
0
 echo "\nGetting identities...\n";
 foreach ($res['identities'] as $r) {
     echo $r['id'] . " - " . $r['label'] . "\n";
 }
 unset($res);
 echo "\nCreating identity...\n";
 $res = $identity->create($label, true);
 echo $res['id'] . " - " . $res['label'] . "\n";
 $id = $res['id'];
 unset($res);
 echo "\nGetting identity...\n";
 $res = $identity->get($id);
 echo $res['id'] . " - " . $res['label'] . "\n";
 unset($res);
 echo "\nUpdating identity...\n";
 $res = $identity->update($id, $label . '-updated', true, 'active');
 echo $res['id'] . " - " . $res['label'] . "\n";
 unset($res);
 echo "\nCreating token....\n";
 $res = $token->create($id, $service, md5('test'));
 echo $res['service'] . " - " . $res['token'] . "\n";
 unset($res);
 echo "\nGetting token...\n";
 $res = $token->get($id, $service);
 echo $res['service'] . " - " . $res['token'] . "\n";
 unset($res);
 echo "\nGetting tokens...\n";
 $res = $token->getAll($id);
 foreach ($res['tokens'] as $r) {
     echo $r['service'] . " - " . $r['token'] . "\n";
 }