Exemplo n.º 1
0
 /**
  * @covers DNSMadeEasy\driver\REST::post
  * @covers DNSMadeEasy\driver\REST::put
  * @covers DNSMadeEasy\driver\REST::delete
  */
 public function testPostPutAndDelete()
 {
     $config = array('name' => 'PHPLibraryTest', 'email' => 'php.library.com', 'ttl' => 86400, 'comp' => 'ns.phplibrarytest.com', 'serial' => 2012020203, 'refresh' => 14400, 'retry' => 1800, 'expire' => 86400, 'negativeCache' => 1800);
     //POST
     $result = $this->rest->post('/dns/soa', $config);
     $this->assertTrue($result->success, "Creating the SoA was unsuccessful");
     $this->assertInstanceOf('DNSMadeEasy\\Result', $result, 'The result should be of the type DNSMadeEasy\\Result');
     $this->assertEquals('PHPLibraryTest', $result->body->name, "The created SoA does not match");
     $id = $result->body->id;
     //PUT
     $config['email'] = 'php2.library.com';
     $result = $this->rest->put("/dns/soa/{$id}", $config);
     $this->assertTrue($result->success, "Updating the SoA was unsuccessful");
     //DELETE
     $result = $this->rest->delete("/dns/soa/{$id}");
     $this->assertTrue($result->success, "Deleting the SoA was unsuccessful");
 }
Exemplo n.º 2
0
 /**
  * Update a record.
  * To update multiple records at once, $data should be an array containing array of records and $recordId is not needed.
  * @param  integer             $domainId The id of the domain.
  * @param  integer             $recordId The id of the record.
  * @param  array               $data     The new configuration for the record.
  * @return \DNSMadeEasy\Result
  */
 public function update($domainId, array $data, $recordId = null)
 {
     if (is_array(reset($data))) {
         return $this->_driver->put("/dns/managed/{$domainId}/records/updateMulti", $data);
     } else {
         $data['id'] = $recordId;
         return $this->_driver->put("/dns/managed/{$domainId}/records/{$recordId}", $data);
     }
 }
Exemplo n.º 3
0
 /**
  * Update a secondary dns domain by its id.
  * @param array|integer $id     An array of domain ids if updating multiple domains or an integer if updating one domain.
  * @param array         $config
  */
 public function update($id, array $config)
 {
     if (is_array($id)) {
         $data = array('ids' => $id);
     } else {
         $data = array('ids' => array($id));
     }
     $data = array_merge($data, $config);
     return $this->_driver->put("/dns/secondary", $data);
 }
Exemplo n.º 4
0
 /**
  * Update a secondary dns record.
  * @param  integer             $domainId The id of the domain.
  * @param  integer             $recordId The id of the record.
  * @param  array               $data     The new configuration for the record.
  * @return \DNSMadeEasy\Result
  */
 public function update($domainId, $recordId, array $data)
 {
     return $this->_driver->put("/dns/secondary/{$domainId}/records/{$recordId}", $data);
 }
Exemplo n.º 5
0
 /**
  * Update an ip set.
  * @param  integer             $id     The id of the ip set.
  * @param  array               $config The new configuration of the ip set.
  * @return \DNSMadeEasy\Result
  */
 public function update($id, array $config)
 {
     return $this->_driver->put("/dns/secondary/ipSet/{$id}", $config);
 }
Exemplo n.º 6
0
 /**
  * Update a SoA record.
  * @param  integer             $id   The id of the SoA record.
  * @param  array               $data The new configuration for the SoA record.
  * @return \DNSMadeEasy\Result
  */
 public function update($id, array $data)
 {
     return $this->_driver->put("/dns/soa/{$id}", $data);
 }
Exemplo n.º 7
0
 /**
  * Update a failover monitor.
  * @param  integer             $id   The id of the failover monitor.
  * @param  array               $data The new configuration of the failover monitor.
  * @return \DNSMadeEasy\Result
  */
 public function update($id, array $data)
 {
     return $this->_driver->put("/monitor/{$id}", $data);
 }
Exemplo n.º 8
0
 /**
  * Update a record in a template.
  * @param  integer             $template Id The id of the template.
  * @param  integer             $recordId The id of the record.
  * @param  array               $data     The new configuration for the record.
  * @return \DNSMadeEasy\Result
  */
 public function update($templateId, $recordId, array $data)
 {
     return $this->_driver->put("/dns/template/{$templateId}/records/{$recordId}", $data);
 }
Exemplo n.º 9
0
 /**
  * Get usage for a secondary domain.
  * @param  integer             $year        The year.
  * @param  integer             $month       The month.
  * @param  unknown             $secondaryId The id of the secondary domain.
  * @return \DNSMadeEasy\Result
  */
 public function getByMonthForSecondary($year, $month, $secondaryId)
 {
     return $this->_driver->get("/usageApi/queriesApi/{$year}/{$month}/secondary/{$secondaryId}");
 }
Exemplo n.º 10
0
 /**
  * Update a folder.
  * @param inteer $id   The id of the folder.
  * @param array  $data The new configuration of the folder.
  */
 public function update($id, array $data)
 {
     return $this->_driver->put("/security/folder/{$id}", $data);
 }