You are here

public function AcquiaLiftAPI::saveDecisionSet in Acquia Lift Connector 7.2

Saves a decision set to Lift.

Parameters

$name: The machine name of the decision set.

$title: The human-readable name of the decision set.

$options: An array of choices to be decided between.

File

includes/AcquiaLiftAPI.inc, line 411

Class

AcquiaLiftAPI

Code

public function saveDecisionSet($name, $title, $options) {
  $decision_set = array(
    'id' => $name,
    'title' => $title,
    'decisions' => array(),
  );
  foreach ($options as $option) {
    $decision_set['decisions'][] = array(
      'external_id' => $option['option_id'],
    );
  }
  $path = "decision_sets";
  $url = $this
    ->generateEndpoint($path);
  $vars = array(
    'name' => $title,
  );
  $success_msg = 'The Decision Set {name} was pushed to Acquia Lift';
  $fail_msg = 'The Decision Set {name} could not be pushed to Acquia Lift';
  $this
    ->makePostRequest($url, $this
    ->getPutHeaders(), $decision_set, $success_msg, $fail_msg, $vars);
}