Author: Chris Knight (chris.knight@datasift.com)
Inheritance: extends DataSift_Account
Example #1
0
 /**
  * @dataProvider updateLimitProvider
  * @covers Datasift_Account_Identity_Limit::update
  */
 public function testUpdateLimit($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->update($identityId, $service, $limit, $analyze_queries);
     $this->assertEquals($expectedResult, $result);
 }
Example #2
0
<?php

// Include the DataSift library
require dirname(__FILE__) . '/../lib/datasift.php';
// Include the configuration - put your username and API key in this file
require dirname(__FILE__) . '/../config.php';
// Authenticate
echo "Creating user...\n";
$user = new DataSift_User(USERNAME, API_KEY);
$service = 'facebook';
$label = 'test-' . time('U');
try {
    $identity = new DataSift_Account_Identity($user);
    $token = new DataSift_Account_Identity_Token($user);
    $limit = new DataSift_Account_Identity_Limit($user);
    $res = $identity->getAll();
    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";