/** * Helper method to execute deferred HTTP requests. * * @returns object of the type of the expected class or array. */ public function execute() { $this->maybeMoveParametersToBody(); return Google_Http_REST::execute($this->client, $this); }
/** * Helper method to execute deferred HTTP requests. * * @param $request Google_Http_Request|Google_Http_Batch * @throws Google_Exception * @return object of the type of the expected class or array. */ public function execute($request) { if ($request instanceof Google_Http_Request) { $request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion()); if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) { $request->enableGzip(); } $request->maybeMoveParametersToBody(); return Google_Http_REST::execute($this, $request); } else { if ($request instanceof Google_Http_Batch) { return $request->execute(); } else { throw new Google_Exception("Do not know how to execute this type of object."); } } }
/** * Helper method to execute deferred HTTP requests. * * @param $request Psr\Http\Message\RequestInterface|Google_Http_Batch * @throws Google_Exception * @return object of the type of the expected class or Psr\Http\Message\ResponseInterface. */ public function execute(RequestInterface $request, $expectedClass = null) { $request = $request->withHeader('User-Agent', $this->config['application_name'] . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion()); // call the authorize method // this is where most of the grunt work is done $http = $this->authorize(); return Google_Http_REST::execute($http, $request, $expectedClass, $this->config['retry']); }
/** * Runs the defined request. * * @return array */ private function makeRequest() { $request = new Google_Http_Request('/test'); $io = $this->getMockBuilder('Google_IO_Abstract')->disableOriginalConstructor()->setMethods(array('makeRequest'))->getMockForAbstractClass(); $io->expects($this->exactly($this->mockedCallsCount))->method('makeRequest')->will($this->returnCallback(array($this, 'getNextMockedCall'))); $this->client->setIo($io); return Google_Http_REST::execute($this->client, $request); }
/** * Helper method to execute deferred HTTP requests. * * @param $request Google_Http_Request|Google_Http_Batch * @throws Google_Exception * @return object of the type of the expected class or array. */ public function execute($request) { if ($request instanceof Google_Http_Request) { $request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion()); if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) { $request->enableGzip(); } $request->maybeMoveParametersToBody(); return Google_Http_REST::execute($this, $request); } else { if ($request instanceof Google_Http_Batch) { return $request->execute(); } else { //throw new Google_Exception("Do not know how to execute this type of object."); echo json_encode(array('status' => FALSE, 'response-code' => 400, 'response' => "Do not know how to execute this type of object.", 'message' => '')); die; } } }
/** * Helper method to execute deferred HTTP requests. * * @param $request GuzzleHttp\Message\RequestInterface|Google_Http_Batch * @throws Google_Exception * @return object of the type of the expected class or array. */ public function execute($request, $expectedClass = null) { $request->setHeader('User-Agent', $this->config->get('application_name') . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion()); $http = $this->getHttpClient(); $result = Google_Http_REST::execute($http, $request, $this->config['retry']); $expectedClass = $expectedClass ?: $request->getHeader('X-Php-Expected-Class'); if ($expectedClass) { $result = new $expectedClass($result); } return $result; }
/** * Runs the defined request. * * @return array */ private function makeRequest() { $request = new Request('GET', '/test'); $http = $this->getMock('GuzzleHttp\\ClientInterface'); $http->expects($this->exactly($this->mockedCallsCount))->method('send')->will($this->returnCallback(array($this, 'getNextMockedCall'))); return Google_Http_REST::execute($http, $request, $this->retryConfig, $this->retryMap); }