コード例 #1
0
 /**
  * Returns an instance of the ApiClient for use in the Traffic Management
  * tests.
  *
  * The test API client has the test adapter already setup, to ease testing
  * and prevent calls to the live API servers.
  *
  * @return DnsApiClient
  */
 public static function getTestTMApiClient()
 {
     $adapter = new TestAdapter();
     $client = new HttpClient('http://www.example.com', array('adapter' => $adapter));
     $apiClient = new DnsApiClient($client);
     // use a dummy token
     $apiClient->setToken('xxxxxxxx');
     return $apiClient;
 }
コード例 #2
0
ファイル: Zone.php プロジェクト: dyninc/dyn-php
 /**
  * Discards any unpublished changes made within the current session
  *
  * @return boolean|ApiResponse
  */
 public function discardChanges()
 {
     $result = $this->apiClient->delete('/ZoneChanges/' . $this->getName());
     if ($result && $result->isOk()) {
         if ($result->isComplete()) {
             return true;
         } else {
             return $result;
         }
     }
     return false;
 }
コード例 #3
0
 /**
  * Delete the specified zone
  *
  * @param  Zone $zone
  * @return boolean|Dyn\TrafficManagement\Api\Response
  */
 public function deleteZone($zone)
 {
     $result = $this->apiClient->delete('/Zone/' . $zone->getName());
     if ($result && $result->isOk()) {
         if ($result->isComplete()) {
             return true;
         } else {
             return $result;
         }
     }
     return false;
 }
コード例 #4
0
 public function testApiCallWithNoTokenThrowsException()
 {
     $this->setExpectedException('Dyn\\TrafficManagement\\Api\\Exception\\NotAuthenticatedException');
     $client = new Client();
     $client->get('/foo');
 }