/** * * @param array $auth * @param Compropago\Client $client * @param string $service * @param string $query * @param string $method * @returns Array */ public static function doExecute(Client $client, $service = null, $query = FALSE, $method = 'GET') { if (!isset($client)) { throw new Exception('Client Required'); } $request = $client->getHttp(); switch ($method) { case 'GET': case 'POST': //supp rest methods $request->setRequestMethod($method); break; default: //no more in rest throw new Exception('Rest Method not supported'); } $request->setServiceUrl($service); if ($query && $method == 'POST') { //just post data, throw con query en GET? $request->setData($query); } $request->setMethodOptions($method); //$request->setOptions($addopts); $curl = new Curl(); $response = $curl->executeRequest($request); //eval aca, errors parse data, http codes fatal exceptions,etc return $response['responseBody']; }
/** * * @param GuzzleHttp\Client $client */ public function __construct(Compropago\Client $client) { $this->client = $client->getHttp(); $this->auth = $client->getAuth(); }