get() public method

Returns the limit for a service
public get ( string $identity, string $service ) : mixed
$identity string
$service string
return mixed
Ejemplo n.º 1
0
 /**
  * @dataProvider getLimitProvider
  * @covers Datasift_Account_Identity_Limit::get
  */
 public function testGetLimit($identityId, $service, $apiResult, $expectedResult)
 {
     $identityLimit = new DataSift_Account_Identity_Limit($this->_user);
     DataSift_MockApiClient::setResponse($apiResult);
     if (isset($expectedResult['error'])) {
         $this->setExpectedException('DataSift_Exception_APIError');
     }
     $result = $identityLimit->get($identityId, $service);
     $this->assertEquals($expectedResult, $result);
 }
Ejemplo n.º 2
0
 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";
 unset($res);
 echo "\nGetting limit...\n";
 $res = $limit->get($id, $service);
 echo $res['id'] . " - " . $res['service'] . " - " . $res['total_allowance'] . " - " . $res['analyze_queries'] . "\n";
 unset($res);
 echo "\nGetting limits...\n";
 $res = $limit->getAll($service);
 $r = $res['limits'];
 echo $r['id'] . " - " . $r['service'] . " - " . $r['total_allowance'] . " - " . $res['analyze_queries'] . "\n";
 unset($res);
 echo "\nUpdating limit...\n";
 $res = $limit->update($id, $service, 10000);
 echo $res['id'] . " - " . $res['service'] . " - " . $res['total_allowance'] . " - " . $res['analyze_queries'] . "\n";
 unset($res);
 echo "\nDeleting limit...\n";
 $res = $limit->delete($id, $service);
 if ($res === true) {
     echo "Deleted\n";