Example #1
0
 public function GetByCep()
 {
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setMethod('GET');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '/' . $this->dto->CEP);
     return $this->_machine->Send($context);
 }
Example #2
0
 public function Get()
 {
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('GET');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI);
     return $this->_machine->Send($context);
 }
Example #3
0
 public function GetByPagamento()
 {
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('GET');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '?data=' . $this->dto->DataPagamento);
     return $this->_machine->Send($context);
 }
Example #4
0
 public function GetByPeriodo()
 {
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('GET');
     $context->setHost($this->_host);
     $context->setRequestURI(sprintf('%s/%s/%s', $this->_requestURI, $this->dto->DataInicio, $this->dto->DataFim));
     return $this->_machine->Send($context);
 }
Example #5
0
 public function Delete($id)
 {
     $this->dto->Id = $id;
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('DELETE');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '/' . $this->dto->Id);
     return $this->_machine->Send($context);
 }
Example #6
0
 public function GetByTipo($tipo)
 {
     $this->dto->Tipo = $tipo;
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('GET');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '/' . $this->dto->Tipo);
     return $this->_machine->Send($context);
 }
Example #7
0
 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);
 }
Example #8
0
 public function Delete()
 {
     $id = $this->dto->Id;
     if (empty($id)) {
         throw new \Exception('Argumento \\"Id\\" é necessario', 1);
     }
     $context = new HttpContext();
     $context->setHeaders($this->_header);
     $context->setAuthorization($this->auth);
     $context->setMethod('DELETE');
     $context->setHost($this->_host);
     $context->setRequestURI($this->_requestURI . '/' . $this->dto->Id);
     return $this->_machine->Send($context);
 }