Example #1
0
 /**
  * Ver http://docs.guzzlephp.org/en/latest/docs.html
  * @return GuzzleHttp\Client
  */
 protected function get_cliente_rest()
 {
     try {
         $opciones = array();
         $cliente = toba::servicio_web_rest('rest_arai_usuarios', $opciones);
         return $cliente->guzzle();
     } catch (toba_error $e) {
         throw new toba_error_usuario("Hay un problema de configuracion del cliente REST. Por favor asegurese de configurarlo correctamente en el archivo cliente.ini.\n<br/><br/>Mensaje: " . $e->get_mensaje());
     }
 }
Example #2
0
 function evt__version()
 {
     $url = toba_http::get_protocolo() . toba_http::get_nombre_servidor() . toba_rest::url_rest() . '/';
     $opciones = array('to' => $url);
     $cliente = toba::servicio_web_rest('rest_localhost', $opciones);
     $resp = $cliente->guzzle()->get('personas');
     if (!$resp->hasHeader('API-Version')) {
         toba::notificacion()->agregar('El header correspondiente a la version de la API no existe');
         return;
     }
     $version = $cliente->get_version_api($resp);
     toba::notificacion()->agregar('Version de la API rest: ' . $version->__toString(), 'info');
 }