DataSift_Account_Identity_Limit::create PHP Method

create() public method

Create a limit for a service
public create ( string $identity, string $service, integer $total_allowance = false, integer $analyze_queries = false ) : mixed
$identity string
$service string
$total_allowance integer
$analyze_queries integer
return mixed
    public function create($identity, $service, $total_allowance = false, $analyze_queries = false)
    {
        $params = array('service' => $service);
        if ($total_allowance) {
            $params['total_allowance'] = $total_allowance;
        }
        if ($analyze_queries) {
            $params['analyze_queries'] = $analyze_queries;
        }
        return $this->_user->post('account/identity/' . $identity . '/limit', $params);
    }

Usage Example

Example #1
0
 /**
  * @dataProvider createLimitProvider
  * @covers Datasift_Account_Identity_Limit::create
  */
 public function testCreateLimit($identityId, $service, $limit, $analyze_queries, $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->create($identityId, $service, $limit, $analyze_queries);
     $this->assertEquals($expectedResult, $result);
 }
All Usage Examples Of DataSift_Account_Identity_Limit::create
DataSift_Account_Identity_Limit