You are here

public function AcquiaLiftAPI::deletePoint in Acquia Lift Connector 7

Deletes an entire decision point from an agent.

Parameters

$agent_name: The name of the agent to delete the point from.

$point: The name of the decision point to delete.

File

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

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function deletePoint($agent_name, $point_name) {
  $url = $this
    ->generateEndpoint("/agent-api/{$agent_name}/points/{$point_name}");
  $response = $this
    ->httpClient()
    ->delete($url);
  $data = json_decode($response->data, TRUE);
  $vars = array(
    'agent' => $agent_name,
    'decpoint' => $point_name,
  );
  $success_msg = 'The decision point {decpoint} was deleted from the Acquia Lift campaign {agent}';
  $fail_msg = 'Could not delete decision point {decpoint} from the Acquia Lift campaign {agent}';
  if ($response->code == 200 && $data['status'] == 'ok') {
    $this
      ->logger()
      ->log(PersonalizeLogLevel::INFO, $success_msg, $vars);
  }
  else {
    $this
      ->handleBadResponse($response->code, $fail_msg, $vars);
  }
}