コード例 #1
0
ファイル: Assinar.php プロジェクト: cbsantos/ClientAPI
 public function Post()
 {
     if (!$this->isValid($this->dto)) {
         throw new \Exception('Campos obrigatórios não foram informados: ' . implode(', ', $this->getError()), 1);
     }
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setMethod('POST');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI);
     $this->_requestJson = $this->dto->fields();
     $context->setBody($this->_requestJson);
     return $this->_machine->Send($context);
 }
コード例 #2
0
ファイル: UsuarioCliente.php プロジェクト: cbsantos/ClientAPI
 public function Put()
 {
     $id = $this->dto->Id;
     if (empty($id)) {
         throw new Exception('Argumento \\"Id\\" é necessario', 1);
     }
     if (!$this->isValid($this->dto)) {
         throw new \Exception('Campos obrigatórios não foram informados: ' . implode(', ', $this->getError()), 1);
     }
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('PUT');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '/' . $this->dto->Id);
     $this->_requestJson = $this->dto->fields();
     $context->setBody($this->_requestJson);
     return $this->_machine->Send($context);
 }