コード例 #1
0
ファイル: APITest.php プロジェクト: nicoSWD/put.io-api-v2
 /**
  *
  */
 public function testSettersAndGettersSetAndReturnCorrectValues()
 {
     $this->api->setOAuthToken('xxxxx');
     $this->assertSame('xxxxx', $this->api->getOAuthToken());
     $this->api->setSSLVerifyPeer(\false);
     $this->assertSame(\false, $this->api->getSSLVerifyPeer());
 }
コード例 #2
0
ファイル: PutIOHelper.php プロジェクト: nicoSWD/put.io-api-v2
 /**
  * Makes an HTTP request to put.io's API and returns the response.
  *
  * @param string $method    HTTP request method. Only POST and GET.
  * @param string $path      Remote path to API module.
  * @param array  $params    Variables to be sent.
  * @param string $outFile   If $outFile is set, the response will be written
  *                              to this file instead of StdOut.
  * @param bool   $returnBool
  * @param string $arrayKey  Will return all data on a specific array key of
  *                              the response.
  * @return mixed
  * @throws \PutIO\Exceptions\LocalStorageException
  */
 protected function request($method, $path, array $params = [], $outFile = '', $returnBool = \false, $arrayKey = '')
 {
     if ($token = $this->putio->getOAuthToken()) {
         $params['oauth_token'] = $token;
     }
     $engine = $this->putio->getHTTPEngine();
     $verifyPeer = $this->putio->getSSLVerifyPeer();
     return $engine->request($method, $path, $params, $outFile, $returnBool, $arrayKey, $verifyPeer);
 }
コード例 #3
0
 /**
  *
  */
 public function setUp()
 {
     $this->api = new \PutIO\API();
     $this->api->setHTTPEngine('Test');
 }
コード例 #4
0
 /**
  *
  */
 public function testGetDownloadURLReturnsCorrectURL()
 {
     $token = $this->api->getOAuthToken();
     $this->assertSame('https://api.put.io/v2/files/41/download?oauth_token=' . $token, $this->api->files->getDownloadURL(41));
     $this->assertSame('https://api.put.io/v2/files/41/mp4/download?oauth_token=' . $token, $this->api->files->getDownloadURL(41, \true));
 }