示例#1
0
 /**
  * @param Contact $contact
  * @return bool
  * @throws APIException
  * @throws \Exception
  */
 public function persist(Contact $contact)
 {
     $data = $contact->toGandiArray();
     if ($contact->isNew()) {
         $response = $this->gandi->create($this->api_key, $data);
         if (is_array($response)) {
             return $response['handle'];
         } else {
             throw new APIException("Cannot create contact.");
         }
     } else {
         $handle = $contact->getHandle();
         $response = $this->gandi->update($this->api_key, $handle, $data);
         if (is_array($response)) {
             return true;
         } else {
             throw new \Exception("Cannot update contact.");
         }
     }
 }
示例#2
0
 public function __call($method, $args)
 {
     if ($method == 'methodSignature') {
         return 'signatures not supported';
     }
     return parent::__call($method, $args);
 }
 /**
  * Call system.listMethods()
  *
  * @param  array  $method
  * @return array  array(method, method, method...)
  */
 public function listMethods()
 {
     return $this->_system->listMethods();
 }
示例#4
0
 /**
  * @param Operation $operation
  * @param array|null $options
  * @return mixed
  */
 public function restart(Operation $operation, array $options = null)
 {
     return $this->gandi->relaunch($this->api_key, $operation->getId(), $options);
 }
示例#5
0
 /**
  * @param array|null $options
  * @return mixed
  */
 public function list(array $options = null)
 {
     $result = $this->gandi->list($this->api_key, $options);
     return $result;
 }