Esempio n. 1
0
 /**
  * @test
  */
 public function get_report_status_will_return_an_object_containing_the_downaload_id()
 {
     $client = $this->prophesize(Auth::class);
     $uploadTicket = new ReportTicket();
     $uploadTicket->setReportId('_a_job_id');
     $fakeResponse = $this->getFakeResponse($this->getReportStatus());
     $client->request('GET', Argument::any(), Argument::any())->willReturn($fakeResponse);
     $report = new Report($client->reveal());
     $reportTicket = $report->getReportStatus($uploadTicket);
     $this->assertEquals('report-download?id=4b22a2c9a361f6d8a8feb99c10745a66', $reportTicket->getUrl());
 }
Esempio n. 2
0
 /**
  * @param array $reportFormat
  *
  * @return array
  * @throws \Audiens\AppnexusClient\exceptions\RepositoryException
  */
 public function getReport($reportFormat = Report::REVENUE_REPORT)
 {
     $reportStatus = $this->report->getReportStatus($this->report->getReportTicket($reportFormat));
     $maxSteps = 0;
     while (!$reportStatus->isReady() && $maxSteps < 10) {
         $reportStatus = $this->report->getReportStatus($reportStatus);
         $maxSteps++;
     }
     return $this->report->getReport($reportStatus);
 }
 /**
  * @param bool|true $cacheToken
  *
  * @return Report
  */
 protected function getReport($cacheToken = true)
 {
     $authClient = $this->getAuth($cacheToken);
     $userUpload = new Report($authClient);
     $userUpload->setBaseUrl(Report::SANDBOX_BASE_URL);
     $userUpload->setBaseUrlDownload(Report::SANDBOX_BASE_URL_DOWNLOAD);
     return $userUpload;
 }