Esempio n. 1
0
 /**
  * @test
  */
 public function get_report_ticket_will_throw_an_exception_if_the_response_is_not_ok()
 {
     $client = $this->prophesize(Auth::class);
     $fakeResponse = $this->getFakeResponse($this->getFailedResponse());
     $client->request('POST', Report::BASE_URL, Argument::any())->willReturn($fakeResponse);
     $report = new Report($client->reveal());
     $this->expectException(ReportException::class);
     $report->getReportTicket();
 }
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);
 }