Example #1
0
 /**
  * Returns the download link
  *
  * @param Ticket $ticket          The ticket previously generated
  * @param string $captchaResponse The captcha response
  *
  * @return DownloadLink
  */
 public function getDownloadLink(Ticket $ticket, $captchaResponse = null)
 {
     $params = ['file' => $ticket->getFileId(), 'ticket' => $ticket->getCode()];
     if ($captchaResponse) {
         $params['captcha_response'] = $captchaResponse;
     }
     $response = $this->processRequest('file/dl', $params);
     $result = $this->processResponse($response);
     return LinkBuilder::buildDownloadLink($result);
 }
Example #2
0
 /**
  * Tests the building of the download link
  */
 public function testBuildDownloadLink()
 {
     $data = json_decode($this->downloadFixture, true);
     $downloadLink = LinkBuilder::buildDownloadLink($data);
     $this->assertInstanceOf('Ideneal\\OpenLoad\\Entity\\DownloadLink', $downloadLink);
 }