You are here

public function AcquiaLiftAPI::getPotentialTargetingValues in Acquia Lift Connector 7

Gets a list of all possible values for the features that have been set.

Parameters

$agent_name: The name of the agent to get targeting values for.

Return value

array An associative array of targeting values structured as follows: array( 'data' => array( 'potential' => array( 'features' => array( // A line like this for every possible value array('code' => 'AFG', 'name' => 'Afghanistan'), ) ) ) )

Throws

AcquiaLiftException

2 calls to AcquiaLiftAPI::getPotentialTargetingValues()
AcquiaLiftAPI::getContextFilters in includes/acquia_lift.classes.inc
Implements AcquiaLiftReportDataSourceInterface::getContextFilters().
AcquiaLiftAPI::getPossibleValues in includes/acquia_lift.classes.inc
Gets array of possible targeting values in the format expected by the plugin.

File

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

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function getPotentialTargetingValues($agent_name) {
  $url = $this
    ->generateEndpoint("/-/potential-targeting?agent={$agent_name}&include-current=true");
  $headers = array(
    'Accept' => 'application/json',
  );
  $response = $this
    ->httpClient()
    ->get($url, $headers);
  if ($response->code != 200) {
    $this
      ->handleBadResponse($response->code, 'Problem retrieving potential targeting values');
    return array();
  }
  return json_decode($response->data, TRUE);
}