/** * Construct Swagger client for calling the petstore * @depends testServiceBuild * @return Client */ public function testClientConstruct(ServiceDescription $service) { $client = new Client(); $client->setDescription($service); $this->assertEquals('http://petstore.swagger.wordnik.com/api', $client->getBaseUrl()); // @todo add Accept: application/json to every request? return $client; }
/** * @param string $image * @param array $dimensions * @return KrakenResponse */ protected function send($image, array $dimensions = []) { switch ($this->service_type) { case 'url': $data = $this->getUrlData($image, $dimensions); break; case 'upload': $data = $this->getUploadData($image, $dimensions); break; } $this->logger->debug('Sending kraken request to ' . $this->guzzle->getBaseUrl() . ' payload: ' . print_r($data, 1)); $request = $this->guzzle->post(null, null, ['body' => $data], ['debug' => true]); $response = $request->send(); return new KrakenResponse($response); }
public function testSupportsServiceDescriptionBaseUrls() { $description = new ServiceDescription(array('baseUrl' => 'http://foo.com')); $client = new Client(); $client->setDescription($description); $this->assertEquals('http://foo.com', $client->getBaseUrl()); }
public function getBaseUrl($expand = true) { return parent::getBaseUrl($expand) . $this->getPath(); }