Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 /**
  * @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());
 }
Exemple #4
0
 public function getBaseUrl($expand = true)
 {
     return parent::getBaseUrl($expand) . $this->getPath();
 }