Esempio n. 1
0
 /**
  *
  */
 public function testSetHTTPEngineWorksWithStringsAndInstances()
 {
     $this->api->setHTTPEngine('Test');
     $this->assertInstanceOf('\\PutIO\\Engines\\HTTP\\TestEngine', $this->api->getHTTPEngine());
     $this->api->setHTTPEngine(new \PutIO\Engines\HTTP\TestEngine());
     $this->assertInstanceOf('\\PutIO\\Engines\\HTTP\\TestEngine', $this->api->getHTTPEngine());
 }
Esempio n. 2
0
 /**
  * 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);
 }