You are here

public function MailChimp_ListsTest::webhookAdd in Mailchimp 7.3

See also

Mailchimp_Lists::webhookAdd()

File

tests/mailchimp_lists_test.inc, line 252
A virtual MailChimp Lists API implementation for use in testing.

Class

MailChimp_ListsTest

Code

public function webhookAdd($id, $url, $actions = array(), $sources = array()) {
  $lists = $this
    ->loadLists();
  if (isset($lists[$id])) {
    $new_id = count($lists[$id]['webhooks']) + 1;
    $webhook = array(
      'id' => $new_id,
      'url' => $url,
      'actions' => $actions,
      'sources' => $sources,
    );
    $lists[$id]['webhooks'][] = $webhook;
    $response = array(
      'id' => $new_id,
    );
    $this
      ->writeLists($lists);
  }
  else {
    $response = array(
      'status' => 'error',
      'code' => 200,
      'name' => 'List_DoesNotExist',
    );
  }
  return $response;
}