/** * */ public function testSettersAndGettersSetAndReturnCorrectValues() { $this->api->setOAuthToken('xxxxx'); $this->assertSame('xxxxx', $this->api->getOAuthToken()); $this->api->setSSLVerifyPeer(\false); $this->assertSame(\false, $this->api->getSSLVerifyPeer()); }
/** * 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); }
/** * */ public function setUp() { $this->api = new \PutIO\API(); $this->api->setHTTPEngine('Test'); }
/** * */ 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)); }