You are here

public function AcquiaLiftAPI::getRawLearningReport in Acquia Lift Connector 7

Implements AcquiaLiftReportDataSourceInterface::getRawLearningReport().

Overrides AcquiaLiftReportDataSourceInterface::getRawLearningReport

File

includes/acquia_lift.classes.inc, line 1222
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function getRawLearningReport($agent_name, $date_start = NULL, $date_end = NULL, $point = NULL) {
  $date_str = $this
    ->getDateString($date_start, $date_end);
  $url = $this
    ->generateEndpoint("/{$agent_name}/report/learning{$date_str}");
  $headers = array(
    'Accept' => 'application/json',
  );
  if ($point !== NULL) {
    $headers['x-mpath-point'] = $point;
  }

  // Use a timeout of 8 seconds for retrieving the transform options.
  $response = $this
    ->httpClient()
    ->get($url, $headers);
  if ($response->code != 200) {
    $this
      ->handleBadResponse($response->code, 'Problem retrieving learning report.');
    return array();
  }
  return json_decode($response->data, TRUE);
}