You are here

class MailchimpAutomations in Mailchimp 8

Same name in this branch
  1. 8 lib/mailchimp-api-php/src/MailchimpAutomations.php \Mailchimp\MailchimpAutomations
  2. 8 lib/mailchimp-api-php/tests/src/MailchimpAutomations.php \Mailchimp\Tests\MailchimpAutomations

Hierarchy

Expanded class hierarchy of MailchimpAutomations

File

lib/mailchimp-api-php/tests/src/MailchimpAutomations.php, line 5

Namespace

Mailchimp\Tests
View source
class MailchimpAutomations extends \Mailchimp\MailchimpAutomations {

  /**
   * @inheritdoc
   */
  public function __construct($api_key = 'apikey', $api_user = 'apikey', $http_options = []) {
    $this->client = new MailchimpTestHttpClient();
  }
  public function getClient() {
    return $this->client;
  }
  public function getEndpoint() {
    return $this->endpoint;
  }

  /**
   * @inheritdoc
   */
  public function getAutomations($parameters = []) {
    parent::getAutomations($parameters);
    $response = (object) [
      'automations' => [
        (object) [
          'id' => '57afe96172',
          'name' => 'Test Automation One',
        ],
        (object) [
          'id' => 'f4b7b26b2e',
          'name' => 'Test Automation Two',
        ],
        (object) [
          'id' => '587693d673',
          'name' => 'Test Automation Three',
        ],
      ],
      'total_items' => 3,
    ];
    return $response;
  }

  /**
   * @inheritdoc
   */
  public function getWorkflow($workflow_id) {
    parent::getWorkflow($workflow_id);
    $response = (object) [
      'id' => 'eb4c82c9d2',
      'create_time' => '2015-07-23T15:15:00+00:00',
      'start_time' => '',
      'status' => 'save',
      'emails_sent' => 0,
    ];
    return $response;
  }

  /**
   * @inheritdoc
   */
  public function getWorkflowEmails($workflow_id) {
    parent::getWorkflowEmails($workflow_id);
    $response = (object) [
      'emails' => [
        (object) [
          'id' => 'a87de7d1e5',
          'workflow_id' => '57afe96172',
          'position' => 1,
          'status' => 'sending',
          'emails_sent' => 1,
          'send_time' => '2016-07-20T15:48:04+00:00',
          'content_type' => 'template',
        ],
      ],
      'total_items' => 1,
    ];
    return $response;
  }

  /**
   * @inheritdoc
   */
  public function getWorkflowEmail($workflow_id, $workflow_email_id) {
    parent::getWorkflowEmail($workflow_id, $workflow_email_id);
    $response = (object) [
      'id' => 'a87de7d1e5',
      'workflow_id' => '57afe96172',
      'position' => 1,
      'status' => 'sending',
      'emails_sent' => 1,
      'send_time' => '2016-07-20T15:48:04+00:00',
      'content_type' => 'template',
    ];
    return $response;
  }

  /**
   * @inheritdoc
   */
  public function getWorkflowEmailSubscribers($workflow_id, $workflow_email_id) {
    parent::getWorkflowEmailSubscribers($workflow_id, $workflow_email_id);
    $response = (object) [
      'workflow_id' => '4e3da78a41',
      'email_id' => 'a87de7d1e5',
      'queue' => [],
      'total_items' => 0,
    ];
    return $response;
  }

  /**
   * @inheritdoc
   */
  public function getWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email) {
    parent::getWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email);
    $response = (object) [
      'id' => md5(strtolower($email)),
      'workflow_id' => '4e3da78a41',
      'email_id' => 'a87de7d1e5',
      'list_id' => '57afe96172',
      'email_address' => $email,
      'next_send' => '2017-04-28T15:48:04+00:00',
    ];
    return $response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Mailchimp::$api_key private property The Mailchimp API key to authenticate with.
Mailchimp::$api_user private property The Mailchimp API username to authenticate with.
Mailchimp::$batch_operations private property Array of pending batch operations.
Mailchimp::$client protected property The HTTP client.
Mailchimp::$debug_error_code private property A Mailchimp API error code to return with every API response.
Mailchimp::$endpoint protected property The REST API endpoint.
Mailchimp::$version public property API version.
Mailchimp::addBatchOperation protected function Adds a pending batch operation.
Mailchimp::DEFAULT_DATA_CENTER constant
Mailchimp::ERROR_CODE_API_KEY_INVALID constant
Mailchimp::ERROR_CODE_API_KEY_MISSING constant
Mailchimp::ERROR_CODE_BAD_REQUEST constant
Mailchimp::ERROR_CODE_COMPLIANCE_RELATED constant
Mailchimp::ERROR_CODE_FORBIDDEN constant
Mailchimp::ERROR_CODE_INTERNAL_SERVER_ERROR constant
Mailchimp::ERROR_CODE_INVALID_ACTION constant
Mailchimp::ERROR_CODE_INVALID_METHOD_OVERRIDE constant
Mailchimp::ERROR_CODE_INVALID_RESOURCE constant
Mailchimp::ERROR_CODE_JSON_PARSE_ERROR constant
Mailchimp::ERROR_CODE_METHOD_NOT_ALLOWED constant
Mailchimp::ERROR_CODE_REQUESTED_FIELDS_INVALID constant
Mailchimp::ERROR_CODE_RESOURCE_NESTING_TOO_DEEP constant
Mailchimp::ERROR_CODE_RESOURCE_NOT_FOUND constant
Mailchimp::ERROR_CODE_TOO_MANY_REQUESTS constant
Mailchimp::ERROR_CODE_USER_DISABLED constant
Mailchimp::ERROR_CODE_WRONG_DATACENTER constant
Mailchimp::getAccount public function Gets Mailchimp account information for the authenticated account.
Mailchimp::getBatchOperation public function Gets the status of a batch request.
Mailchimp::getDataCenter private function Gets the ID of the data center associated with an API key.
Mailchimp::getDefaultHttpClient private function Instantiates a default HTTP client based on the local environment.
Mailchimp::processBatchOperations public function Processes all pending batch operations.
Mailchimp::request public function Makes a request to the Mailchimp API.
Mailchimp::setClient public function Sets a custom HTTP client to be used for all API requests.
Mailchimp::setDebugErrorCode public function Sets a Mailchimp error code to be returned by all requests.
Mailchimp::VERSION constant
MailchimpAutomations::addWorkflowEmailSubscriber public function Adds a subscriber to a Mailchimp workflow automation email queue.
MailchimpAutomations::getAutomations public function @inheritdoc Overrides MailchimpAutomations::getAutomations
MailchimpAutomations::getClient public function
MailchimpAutomations::getEndpoint public function
MailchimpAutomations::getWorkflow public function @inheritdoc Overrides MailchimpAutomations::getWorkflow
MailchimpAutomations::getWorkflowEmail public function @inheritdoc Overrides MailchimpAutomations::getWorkflowEmail
MailchimpAutomations::getWorkflowEmails public function @inheritdoc Overrides MailchimpAutomations::getWorkflowEmails
MailchimpAutomations::getWorkflowEmailSubscriber public function @inheritdoc Overrides MailchimpAutomations::getWorkflowEmailSubscriber
MailchimpAutomations::getWorkflowEmailSubscribers public function @inheritdoc Overrides MailchimpAutomations::getWorkflowEmailSubscribers
MailchimpAutomations::__construct public function @inheritdoc Overrides Mailchimp::__construct