Exemplo n.º 1
0
Arquivo: Upload.php Projeto: lsv/jwapi
 /**
  * Create our second level request for posting items
  *
  * @param Api         $api
  * @param SplFileInfo $file
  * @param bool        $method
  */
 public function __construct(Api $api, SplFileInfo $file, $method)
 {
     $data = $api->getResponse()->json();
     parent::__construct($api->getApiKey(), $api->getApiSecret(), $api->getHttps());
     $this->path = sprintf('%s://%s%s', $data['link']['protocol'], $data['link']['address'], $data['link']['path']);
     $this->setGet('key', $data['link']['query']['key'])->setGet('token', $data['link']['query']['token'])->setPost('file', '@' . $file->getPath() . '/' . $file->getFilename());
 }
Exemplo n.º 2
0
 protected function checkUrl(Api $class, $url)
 {
     $this->assertEquals($class->getHttps() ? 'https' : 'http', $url['scheme']);
     $this->assertEquals($class->getApiUrl(), $url['host']);
     $this->assertEquals($class->getPath(), $url['path']);
 }