Пример #1
0
 public function testCreateWithOptions()
 {
     $rawSession = $this->getRawTestSession();
     $session = $this->getTestSession();
     $date = date('r', strtotime('+10 min'));
     $this->requestMock->shouldReceive('send')->with('/sessions', null, ['document_id' => $session->document()->id(), 'duration' => 10, 'expires_at' => date('c', strtotime($date)), 'is_downloadable' => true, 'is_text_selectable' => false], null)->andReturn($rawSession);
     $docId = $session->document()->id();
     $response = \Box\View\Session::create($this->client, $docId, ['duration' => 10, 'expiresAt' => $date, 'isDownloadable' => true, 'isTextSelectable' => false]);
     $this->assertEquals($session, $response);
     $this->assertEquals($session->document()->id(), $response->document()->id());
 }
Пример #2
0
 /**
  * Create a session for a specific document.
  *
  * @param array|null $params Optional. An associative array of options
  *                           relating to the new session. None are
  *                           necessary; all are optional. Use the following
  *                           options:
  *                             - int|null 'duration' The number of minutes
  *                               for the session to last.
  *                             - string|DateTime|null 'expiresAt' When the
  *                               session should expire.
  *                             - bool|null 'isDownloadable' Should the user
  *                               be allowed to download the original file?
  *                             - bool|null 'isTextSelectable' Should the
  *                               user be allowed to select text?
  *
  * @return \Box\View\Session A new session instance.
  * @throws \Box\View\BoxViewException
  */
 public function createSession($params = [])
 {
     return Session::create($this->client, $this->id, $params);
 }