get() 공개 메소드

Gets the token for a service
public get ( string $identity, string $service ) : mixed
$identity string
$service string
리턴 mixed
예제 #1
0
 /**
  * @dataProvider getTokenProvider
  * @covers Datasift_Account_Identity_Token::get
  */
 public function testGetToken($identityId, $service, $apiResult, $expectedResult)
 {
     $identityToken = new DataSift_Account_Identity_Token($this->_user);
     DataSift_MockApiClient::setResponse($apiResult);
     if (isset($expectedResult['error'])) {
         $this->setExpectedException('DataSift_Exception_APIError');
     }
     $result = $identityToken->get($identityId, $service);
     $this->assertEquals($expectedResult, $result);
 }
예제 #2
0
 $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";
 }
 unset($res);
 echo "\nUpdating token...\n";
 $res = $token->update($id, $service, md5('test'));
 echo $res['service'] . " - " . $res['token'] . "\n";
 unset($res);
 echo "\nCreating limit...\n";
 $res = $limit->create($id, $service, 2000, 3000);
 echo $res['id'] . " - " . $res['service'] . " - " . $res['total_allowance'] . " - " . $res['analyze_queries'] . "\n";