public function testSetGetApiClient()
 {
     $factory = $this->getClientFactory();
     $factory->expects($this->never())->method($this->anything());
     $clientStub = new GuzzleClient();
     $manager = new BoxClient\ClientManager('', $factory);
     $manager->setApiClient($clientStub);
     $this->assertSame($clientStub, $manager->getApiClient());
 }
Beispiel #2
0
 /**
  * @param $documentId
  * @param int|\DateTime $expiration
  * @param bool $isDownloadable
  * @param bool $isTextSelectable
  * @return Response\Entity\Document
  */
 public function createSession($documentId, $expiration = 60, $isDownloadable = false, $isTextSelectable = true)
 {
     $postData = ['document_id' => $documentId, 'is_downloadable' => $isDownloadable ? 'true' : 'false', 'is_text_selectable' => $isTextSelectable ? 'true' : 'false'];
     if ($expiration instanceof \DateTime) {
         $postData['expires_at'] = $expiration->format(\DateTime::RFC3339);
     } else {
         $postData['duration'] = $expiration;
     }
     return $this->responseHandler->getSession($this->sendRequest($this->clientManager->getApiClient(), 'POST', 'sessions', ['json' => $postData]));
 }