Exemple #1
0
 public function agregar_cuenta($identificador_aplicacion, $datos_cuenta)
 {
     try {
         $url = "aplicaciones/{$identificador_aplicacion}/cuentas";
         // obtengo la respuesta
         $response = $this->cliente->post($url, array('body' => rest_encode($datos_cuenta)));
         $datos = rest_decode($response->json());
         return $datos;
     } catch (RequestException $e) {
         $this->manejar_excepcion_request($e);
     } catch (Exception $e) {
         throw new toba_error($e);
     }
 }
Exemple #2
0
 function evt__imagen__put_imagen($datos)
 {
     if (isset($datos['imagen'])) {
         $path = $this->mover_a_directorio_propio($datos['imagen']);
         $imagen = file_get_contents($path, FILE_BINARY);
         $img_para_ws = base64_encode($imagen);
         $mensaje = array('imagen' => $img_para_ws);
         $cliente = $this->get_cliente_rest();
         try {
             $response = $cliente->put('personas/' . $datos['persona'], array('body' => rest_encode($mensaje)));
             $this->debug($response);
             toba::notificacion()->info("Persona actualizada");
         } catch (RequestException $e) {
             $this->manejar_excepcion_request($e);
         } catch (Exception $e) {
             throw new toba_error($e);
         }
     } else {
         toba::notificacion()->info("Debe escoger una imagen para usar esta acción");
     }
 }