update to campign monitor plugin
Showing
69 changed files
with
1113 additions
and
223 deletions
| 1 | { | 1 | { |
| 2 | "_readme": [ | 2 | "_readme": [ |
| 3 | "This file locks the dependencies of your project to a known state", | 3 | "This file locks the dependencies of your project to a known state", |
| 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
| 5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
| 6 | ], | 6 | ], |
| 7 | "hash": "ac95bee6727d63b7f76eeff290c1460c", | 7 | "content-hash": "57adffeef0b1837401aa65c780f09e79", |
| 8 | "content-hash": "14d0d7fbb4109cdf1d2e75483963ace9", | ||
| 9 | "packages": [ | 8 | "packages": [ |
| 10 | { | 9 | { |
| 11 | "name": "campaignmonitor/createsend-php", | 10 | "name": "campaignmonitor/createsend-php", |
| 12 | "version": "v5.0.2", | 11 | "version": "v6.1.2", |
| 13 | "source": { | 12 | "source": { |
| 14 | "type": "git", | 13 | "type": "git", |
| 15 | "url": "https://github.com/campaignmonitor/createsend-php.git", | 14 | "url": "https://github.com/campaignmonitor/createsend-php.git", |
| 16 | "reference": "05407e838eda316709d55011ad7328a679296988" | 15 | "reference": "922cec7fbc9da1508c18156db7693a6ddad7194e" |
| 17 | }, | 16 | }, |
| 18 | "dist": { | 17 | "dist": { |
| 19 | "type": "zip", | 18 | "type": "zip", |
| 20 | "url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/05407e838eda316709d55011ad7328a679296988", | 19 | "url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/922cec7fbc9da1508c18156db7693a6ddad7194e", |
| 21 | "reference": "05407e838eda316709d55011ad7328a679296988", | 20 | "reference": "922cec7fbc9da1508c18156db7693a6ddad7194e", |
| 22 | "shasum": "" | 21 | "shasum": "" |
| 23 | }, | 22 | }, |
| 24 | "require": { | 23 | "require": { |
| 25 | "php": ">=5.3.0" | 24 | "php": ">=5.3.0" |
| 26 | }, | 25 | }, |
| 27 | "require-dev": { | 26 | "require-dev": { |
| 28 | "lastcraft/simpletest": "~1.1" | 27 | "simpletest/simpletest": "~1.1.3" |
| 29 | }, | 28 | }, |
| 30 | "type": "library", | 29 | "type": "library", |
| 31 | "autoload": { | 30 | "autoload": { |
| ... | @@ -34,6 +33,7 @@ | ... | @@ -34,6 +33,7 @@ |
| 34 | "csrest_campaigns.php", | 33 | "csrest_campaigns.php", |
| 35 | "csrest_clients.php", | 34 | "csrest_clients.php", |
| 36 | "csrest_general.php", | 35 | "csrest_general.php", |
| 36 | "csrest_events.php", | ||
| 37 | "csrest_lists.php", | 37 | "csrest_lists.php", |
| 38 | "csrest_people.php", | 38 | "csrest_people.php", |
| 39 | "csrest_segments.php", | 39 | "csrest_segments.php", |
| ... | @@ -41,7 +41,9 @@ | ... | @@ -41,7 +41,9 @@ |
| 41 | "csrest_templates.php", | 41 | "csrest_templates.php", |
| 42 | "csrest_transactional_classicemail.php", | 42 | "csrest_transactional_classicemail.php", |
| 43 | "csrest_transactional_smartemail.php", | 43 | "csrest_transactional_smartemail.php", |
| 44 | "csrest_transactional_timeline.php" | 44 | "csrest_transactional_timeline.php", |
| 45 | "csrest_journeys.php", | ||
| 46 | "csrest_journey_emails.php" | ||
| 45 | ] | 47 | ] |
| 46 | }, | 48 | }, |
| 47 | "notification-url": "https://packagist.org/downloads/", | 49 | "notification-url": "https://packagist.org/downloads/", |
| ... | @@ -62,7 +64,11 @@ | ... | @@ -62,7 +64,11 @@ |
| 62 | "campaign", | 64 | "campaign", |
| 63 | "monitor" | 65 | "monitor" |
| 64 | ], | 66 | ], |
| 65 | "time": "2016-07-19 18:49:32" | 67 | "support": { |
| 68 | "issues": "https://github.com/campaignmonitor/createsend-php/issues", | ||
| 69 | "source": "https://github.com/campaignmonitor/createsend-php/tree/v6.1.2" | ||
| 70 | }, | ||
| 71 | "time": "2021-10-02T04:57:43+00:00" | ||
| 66 | } | 72 | } |
| 67 | ], | 73 | ], |
| 68 | "packages-dev": [], | 74 | "packages-dev": [], |
| ... | @@ -72,5 +78,6 @@ | ... | @@ -72,5 +78,6 @@ |
| 72 | "prefer-stable": false, | 78 | "prefer-stable": false, |
| 73 | "prefer-lowest": false, | 79 | "prefer-lowest": false, |
| 74 | "platform": [], | 80 | "platform": [], |
| 75 | "platform-dev": [] | 81 | "platform-dev": [], |
| 82 | "plugin-api-version": "2.3.0" | ||
| 76 | } | 83 | } | ... | ... |
| ... | @@ -211,6 +211,7 @@ add_action('wp_ajax_load_campaign_data', 'campaign_Monitor_LoadData'); | ... | @@ -211,6 +211,7 @@ add_action('wp_ajax_load_campaign_data', 'campaign_Monitor_LoadData'); |
| 211 | 211 | ||
| 212 | function campaign_Monitor_LoadData() | 212 | function campaign_Monitor_LoadData() |
| 213 | { | 213 | { |
| 214 | |||
| 214 | $action = $_POST['action']; | 215 | $action = $_POST['action']; |
| 215 | $year = $_POST['year']; | 216 | $year = $_POST['year']; |
| 216 | 217 | ||
| ... | @@ -223,12 +224,15 @@ function campaign_Monitor_LoadData() | ... | @@ -223,12 +224,15 @@ function campaign_Monitor_LoadData() |
| 223 | $apiKey = get_option('cm_api_key'); | 224 | $apiKey = get_option('cm_api_key'); |
| 224 | 225 | ||
| 225 | if ($clientID !== false && $apiKey !== false) { | 226 | if ($clientID !== false && $apiKey !== false) { |
| 227 | |||
| 226 | $auth = array('api_key' => $apiKey); | 228 | $auth = array('api_key' => $apiKey); |
| 227 | $wrap = new CS_REST_Clients( | 229 | $wrap = new CS_REST_Clients( |
| 228 | $clientID, | 230 | $clientID, |
| 229 | $auth | 231 | $auth |
| 230 | ); | 232 | ); |
| 233 | |||
| 231 | $result = $wrap->get_campaigns(); | 234 | $result = $wrap->get_campaigns(); |
| 235 | // var_dump($result);exit; | ||
| 232 | if ($result->was_successful()) { | 236 | if ($result->was_successful()) { |
| 233 | set_transient('cm_' . $clientID, serialize($result->response), DAY_IN_SECONDS); | 237 | set_transient('cm_' . $clientID, serialize($result->response), DAY_IN_SECONDS); |
| 234 | } else { | 238 | } else { |
| ... | @@ -260,6 +264,7 @@ function campaign_Monitor_LoadData() | ... | @@ -260,6 +264,7 @@ function campaign_Monitor_LoadData() |
| 260 | } | 264 | } |
| 261 | 265 | ||
| 262 | $results = get_posts($args); | 266 | $results = get_posts($args); |
| 267 | |||
| 263 | foreach ($results as $post) : setup_postdata($post); | 268 | foreach ($results as $post) : setup_postdata($post); |
| 264 | wp_delete_post($post->ID, true); | 269 | wp_delete_post($post->ID, true); |
| 265 | endforeach; | 270 | endforeach; |
| ... | @@ -268,6 +273,7 @@ function campaign_Monitor_LoadData() | ... | @@ -268,6 +273,7 @@ function campaign_Monitor_LoadData() |
| 268 | $campaignItemArray = campaign_Monitor_GetData('DESC'); | 273 | $campaignItemArray = campaign_Monitor_GetData('DESC'); |
| 269 | /** @var campaignItemClass $campaignItemObject */ | 274 | /** @var campaignItemClass $campaignItemObject */ |
| 270 | foreach ($campaignItemArray as $campaignItemObject) { | 275 | foreach ($campaignItemArray as $campaignItemObject) { |
| 276 | |||
| 271 | $itemYear = (int)date("Y", strtotime($campaignItemObject->getItemDate())); | 277 | $itemYear = (int)date("Y", strtotime($campaignItemObject->getItemDate())); |
| 272 | if($itemYear == $year) { | 278 | if($itemYear == $year) { |
| 273 | $dom = new DOMDocument; | 279 | $dom = new DOMDocument; |
| ... | @@ -285,7 +291,7 @@ function campaign_Monitor_LoadData() | ... | @@ -285,7 +291,7 @@ function campaign_Monitor_LoadData() |
| 285 | $DivContent = $DOMxpath->query("//div"); | 291 | $DivContent = $DOMxpath->query("//div"); |
| 286 | $postContent = $DivContent->item(0)->textContent; | 292 | $postContent = $DivContent->item(0)->textContent; |
| 287 | $cm_post = [ | 293 | $cm_post = [ |
| 288 | 'post_title' => $campaignItemObject->getItemName(), | 294 | 'post_title' => $campaignItemObject->item->Subject, |
| 289 | 'post_type' => 'campaign', | 295 | 'post_type' => 'campaign', |
| 290 | 'post_status' => 'publish', | 296 | 'post_status' => 'publish', |
| 291 | 'post_content' => utf8_decode($postContent), | 297 | 'post_content' => utf8_decode($postContent), | ... | ... |
| ... | @@ -2,6 +2,24 @@ | ... | @@ -2,6 +2,24 @@ |
| 2 | 2 | ||
| 3 | // autoload.php @generated by Composer | 3 | // autoload.php @generated by Composer |
| 4 | 4 | ||
| 5 | if (PHP_VERSION_ID < 50600) { | ||
| 6 | if (!headers_sent()) { | ||
| 7 | header('HTTP/1.1 500 Internal Server Error'); | ||
| 8 | } | ||
| 9 | $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; | ||
| 10 | if (!ini_get('display_errors')) { | ||
| 11 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { | ||
| 12 | fwrite(STDERR, $err); | ||
| 13 | } elseif (!headers_sent()) { | ||
| 14 | echo $err; | ||
| 15 | } | ||
| 16 | } | ||
| 17 | trigger_error( | ||
| 18 | $err, | ||
| 19 | E_USER_ERROR | ||
| 20 | ); | ||
| 21 | } | ||
| 22 | |||
| 5 | require_once __DIR__ . '/composer/autoload_real.php'; | 23 | require_once __DIR__ . '/composer/autoload_real.php'; |
| 6 | 24 | ||
| 7 | return ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d::getLoader(); | 25 | return ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d::getLoader(); | ... | ... |
| 1 | language: php | 1 | language: php |
| 2 | 2 | ||
| 3 | php: | 3 | matrix: |
| 4 | - 5.3 | 4 | include: |
| 5 | - 5.4 | 5 | - php: 5.3 |
| 6 | - 5.5 | 6 | dist: precise |
| 7 | - 5.6 | 7 | - php: 5.4 |
| 8 | - 7.0 | 8 | dist: trusty |
| 9 | - hhvm | 9 | - php: 5.5 |
| 10 | dist: trusty | ||
| 11 | - php: 5.6 | ||
| 12 | - php: 7.0 | ||
| 13 | - php: 7.1 | ||
| 14 | - php: 7.2 | ||
| 15 | - php: 7.3 | ||
| 16 | - php: 7.4 | ||
| 17 | - php: hhvm-3.30 | ||
| 10 | 18 | ||
| 11 | before_script: composer install --dev | 19 | before_script: composer install --dev |
| 12 | script: cd tests && php all_tests.php && cd .. | 20 | script: cd tests && php all_tests.php && cd .. | ... | ... |
| 1 | # createsend-php history | 1 | # createsend-php history |
| 2 | 2 | ||
| 3 | ## v6.1.2 - 2nd Oct, 2021 | ||
| 4 | |||
| 5 | * Changed local API timeout from 20 secs to 120 secs to cater for changes on get segment subscribers API endpoint. | ||
| 6 | |||
| 7 | ## v6.1.1 - 6th May, 2020 | ||
| 8 | |||
| 9 | * Add PHP 7.4 Support | ||
| 10 | |||
| 11 | ## v6.1.0 - 3rd September, 2019 | ||
| 12 | |||
| 13 | * Added support for the Journeys API (https://www.campaignmonitor.com/api/journeys/) | ||
| 14 | |||
| 15 | ## v6.0.0 - 23 May, 2018 | ||
| 16 | |||
| 17 | * Upgrades to Createsend API v3.2 which includes new breaking changes | ||
| 18 | * Breaking: 'Consent to track' field is now mandatory for sending smart and classic transactionl emails | ||
| 19 | * Breaking: 'Consent to track' field is now mandatory when adding or updating subscribers | ||
| 20 | * Optional 'Include tracking preference' field when retrieving lists of subscribers | ||
| 21 | |||
| 22 | ## v5.1.3 - 15th May, 2017 | ||
| 23 | |||
| 24 | * Changed local API timeout from 10 sec to 20 sec | ||
| 25 | |||
| 26 | ## v5.1.2 - 15th May, 2017 | ||
| 27 | |||
| 28 | * Added support for Behavioral Event data | ||
| 29 | |||
| 3 | ## v5.0.2 - 18 July, 2016 | 30 | ## v5.0.2 - 18 July, 2016 |
| 4 | 31 | ||
| 5 | * Prevent definition re-declarations | 32 | * Prevent definition re-declarations | ... | ... |
| 1 | # createsend [][travis] | 1 | # createsend [](https://app.travis-ci.com/campaignmonitor/createsend-php) |
| 2 | A PHP library which implements the complete functionality of the [Campaign Monitor API](http://www.campaignmonitor.com/api/). | 2 | A PHP library which implements the complete functionality of the [Campaign Monitor API](http://www.campaignmonitor.com/api/). |
| 3 | 3 | ||
| 4 | [travis]: http://travis-ci.org/campaignmonitor/createsend-php | ||
| 5 | |||
| 6 | ## Installation | 4 | ## Installation |
| 7 | 5 | ||
| 8 | If you use [Composer](http://getcomposer.org/), you can add [campaignmonitor/createsend-php](https://packagist.org/packages/campaignmonitor/createsend-php) to your `composer.json` file: | 6 | ### Composer |
| 7 | If you use [Composer](http://getcomposer.org/), you can run the following command from the root of your project: | ||
| 8 | |||
| 9 | ``` | ||
| 10 | composer require campaignmonitor/createsend-php | ||
| 11 | ``` | ||
| 12 | |||
| 13 | Or add [campaignmonitor/createsend-php](https://packagist.org/packages/campaignmonitor/createsend-php) to your `composer.json` file: | ||
| 9 | 14 | ||
| 10 | ```json | 15 | ```json |
| 11 | { | 16 | { |
| ... | @@ -15,6 +20,13 @@ If you use [Composer](http://getcomposer.org/), you can add [campaignmonitor/cre | ... | @@ -15,6 +20,13 @@ If you use [Composer](http://getcomposer.org/), you can add [campaignmonitor/cre |
| 15 | } | 20 | } |
| 16 | ``` | 21 | ``` |
| 17 | 22 | ||
| 23 | Followed by running: | ||
| 24 | |||
| 25 | ``` | ||
| 26 | composer update | ||
| 27 | ``` | ||
| 28 | |||
| 29 | ### Manual Installation | ||
| 18 | Otherwise you can simply [download](https://github.com/campaignmonitor/createsend-php/tags) the library and include it in your project. | 30 | Otherwise you can simply [download](https://github.com/campaignmonitor/createsend-php/tags) the library and include it in your project. |
| 19 | 31 | ||
| 20 | After you have installed the library, simply include the relevant API class, as follows: | 32 | After you have installed the library, simply include the relevant API class, as follows: |
| ... | @@ -120,6 +132,8 @@ $wrap = new CS_REST_General($auth); | ... | @@ -120,6 +132,8 @@ $wrap = new CS_REST_General($auth); |
| 120 | $result = $wrap->get_clients(); | 132 | $result = $wrap->get_clients(); |
| 121 | var_dump($result->response); | 133 | var_dump($result->response); |
| 122 | ``` | 134 | ``` |
| 135 | ## API Call Timeout | ||
| 136 | You can set your local API call timeout time in createsend-php\class\transport.php line 11, in the CS_REST_CALL_TIMEOUT variable. Currently the default is 120 secs. | ||
| 123 | 137 | ||
| 124 | ## Examples | 138 | ## Examples |
| 125 | 139 | ... | ... |
| ... | @@ -4,7 +4,7 @@ require_once dirname(__FILE__).'/serialisation.php'; | ... | @@ -4,7 +4,7 @@ require_once dirname(__FILE__).'/serialisation.php'; |
| 4 | require_once dirname(__FILE__).'/transport.php'; | 4 | require_once dirname(__FILE__).'/transport.php'; |
| 5 | require_once dirname(__FILE__).'/log.php'; | 5 | require_once dirname(__FILE__).'/log.php'; |
| 6 | 6 | ||
| 7 | defined('CS_REST_WRAPPER_VERSION') or define('CS_REST_WRAPPER_VERSION', '5.0.2'); | 7 | defined('CS_REST_WRAPPER_VERSION') or define('CS_REST_WRAPPER_VERSION', '6.1.2'); |
| 8 | defined('CS_HOST') or define('CS_HOST', 'api.createsend.com'); | 8 | defined('CS_HOST') or define('CS_HOST', 'api.createsend.com'); |
| 9 | defined('CS_OAUTH_BASE_URI') or define('CS_OAUTH_BASE_URI', 'https://'.CS_HOST.'/oauth'); | 9 | defined('CS_OAUTH_BASE_URI') or define('CS_OAUTH_BASE_URI', 'https://'.CS_HOST.'/oauth'); |
| 10 | defined('CS_OAUTH_TOKEN_URI') or define('CS_OAUTH_TOKEN_URI', CS_OAUTH_BASE_URI.'/token'); | 10 | defined('CS_OAUTH_TOKEN_URI') or define('CS_OAUTH_TOKEN_URI', CS_OAUTH_BASE_URI.'/token'); |
| ... | @@ -146,7 +146,7 @@ if (!class_exists('CS_REST_Wrapper_Base')) { | ... | @@ -146,7 +146,7 @@ if (!class_exists('CS_REST_Wrapper_Base')) { |
| 146 | $this->_log = is_null($log) ? new CS_REST_Log($debug_level) : $log; | 146 | $this->_log = is_null($log) ? new CS_REST_Log($debug_level) : $log; |
| 147 | 147 | ||
| 148 | $this->_protocol = $protocol; | 148 | $this->_protocol = $protocol; |
| 149 | $this->_base_route = $protocol.'://'.$host.'/api/v3.1/'; | 149 | $this->_base_route = $protocol.'://'.$host.'/api/v3.2/'; |
| 150 | 150 | ||
| 151 | $this->_log->log_message('Creating wrapper for '.$this->_base_route, get_class($this), CS_REST_LOG_VERBOSE); | 151 | $this->_log->log_message('Creating wrapper for '.$this->_base_route, get_class($this), CS_REST_LOG_VERBOSE); |
| 152 | 152 | ||
| ... | @@ -164,13 +164,14 @@ if (!class_exists('CS_REST_Wrapper_Base')) { | ... | @@ -164,13 +164,14 @@ if (!class_exists('CS_REST_Wrapper_Base')) { |
| 164 | 164 | ||
| 165 | $this->_default_call_options = array ( | 165 | $this->_default_call_options = array ( |
| 166 | 'authdetails' => $auth_details, | 166 | 'authdetails' => $auth_details, |
| 167 | 'userAgent' => 'CS_REST_Wrapper v'.CS_REST_WRAPPER_VERSION. | 167 | 'userAgent' => 'createsend-php v'.CS_REST_WRAPPER_VERSION. |
| 168 | ' PHPv'.phpversion().' over '.$transport_type.' with '.$this->_serialiser->get_type(), | 168 | ' PHPv'.phpversion().' over '.$transport_type.' with '.$this->_serialiser->get_type(), |
| 169 | 'contentType' => 'application/json; charset=utf-8', | 169 | 'contentType' => 'application/json; charset=utf-8', |
| 170 | 'deserialise' => true, | 170 | 'deserialise' => true, |
| 171 | 'host' => $host, | 171 | 'host' => $host, |
| 172 | 'protocol' => $protocol | 172 | 'protocol' => $protocol |
| 173 | ); | 173 | ); |
| 174 | |||
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | /** | 177 | /** |
| ... | @@ -230,7 +231,13 @@ if (!class_exists('CS_REST_Wrapper_Base')) { | ... | @@ -230,7 +231,13 @@ if (!class_exists('CS_REST_Wrapper_Base')) { |
| 230 | return $this->_call($call_options, CS_REST_DELETE, $route); | 231 | return $this->_call($call_options, CS_REST_DELETE, $route); |
| 231 | } | 232 | } |
| 232 | 233 | ||
| 233 | function get_request($route, $call_options = array()) { | 234 | function get_request($route, $include_tracking_pref = NULL, $call_options = array()) { |
| 235 | |||
| 236 | if(isset($include_tracking_pref) | ||
| 237 | && is_bool($include_tracking_pref)) { | ||
| 238 | $route .= '&includeTrackingPreference='.($include_tracking_pref ? "true" : "false"); | ||
| 239 | } | ||
| 240 | |||
| 234 | return $this->_call($call_options, CS_REST_GET, $route); | 241 | return $this->_call($call_options, CS_REST_GET, $route); |
| 235 | } | 242 | } |
| 236 | 243 | ||
| ... | @@ -247,29 +254,36 @@ if (!class_exists('CS_REST_Wrapper_Base')) { | ... | @@ -247,29 +254,36 @@ if (!class_exists('CS_REST_Wrapper_Base')) { |
| 247 | return $this->get_request($route); | 254 | return $this->get_request($route); |
| 248 | } | 255 | } |
| 249 | 256 | ||
| 250 | function get_request_paged($route, $page_number, $page_size, $order_field, $order_direction, | 257 | function get_request_paged($route, $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref = NULL, |
| 251 | $join_char = '&') { | 258 | $join_char = 'deprecated') { |
| 259 | // Stores our query values | ||
| 260 | $query = array(); | ||
| 261 | // Extract any initial queries in the route into our local query | ||
| 262 | if(strpos($route, '?') !== false) { | ||
| 263 | $parts = parse_url($route); | ||
| 264 | $route = current(explode('?', $route)); | ||
| 265 | if(array_key_exists('query', $parts) && !empty($parts['query'])) { | ||
| 266 | parse_str($parts['query'], $query); | ||
| 267 | } | ||
| 268 | } | ||
| 269 | // Now selectively add supplied vars to the query | ||
| 252 | if(!is_null($page_number)) { | 270 | if(!is_null($page_number)) { |
| 253 | $route .= $join_char.'page='.$page_number; | 271 | $query['page'] = $page_number; |
| 254 | $join_char = '&'; | ||
| 255 | } | 272 | } |
| 256 | |||
| 257 | if(!is_null($page_size)) { | 273 | if(!is_null($page_size)) { |
| 258 | $route .= $join_char.'pageSize='.$page_size; | 274 | $query['pageSize'] = $page_size; |
| 259 | $join_char = '&'; | ||
| 260 | } | 275 | } |
| 261 | |||
| 262 | if(!is_null($order_field)) { | 276 | if(!is_null($order_field)) { |
| 263 | $route .= $join_char.'orderField='.$order_field; | 277 | $query['orderField'] = $order_field; |
| 264 | $join_char = '&'; | ||
| 265 | } | 278 | } |
| 266 | |||
| 267 | if(!is_null($order_direction)) { | 279 | if(!is_null($order_direction)) { |
| 268 | $route .= $join_char.'orderDirection='.$order_direction; | 280 | $query['orderDirection'] = $order_direction; |
| 269 | $join_char = '&'; | ||
| 270 | } | 281 | } |
| 271 | 282 | // If we ended up with a query, add it back to the route | |
| 272 | return $this->get_request($route); | 283 | if(!empty($query)) { |
| 284 | $route .= '?'.http_build_query($query); | ||
| 285 | } | ||
| 286 | return $this->get_request($route, $include_tracking_pref); | ||
| 273 | } | 287 | } |
| 274 | 288 | ||
| 275 | /** | 289 | /** |
| ... | @@ -300,4 +314,4 @@ if (!class_exists('CS_REST_Wrapper_Base')) { | ... | @@ -300,4 +314,4 @@ if (!class_exists('CS_REST_Wrapper_Base')) { |
| 300 | return new CS_REST_Wrapper_Result($call_result['response'], $call_result['code']); | 314 | return new CS_REST_Wrapper_Result($call_result['response'], $call_result['code']); |
| 301 | } | 315 | } |
| 302 | } | 316 | } |
| 303 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 317 | } | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | if (!class_exists('Services_JSON', false)) { | ||
| 4 | require_once dirname(__FILE__).'/services_json.php'; | ||
| 5 | } | ||
| 6 | |||
| 7 | if(!function_exists("CS_REST_SERIALISATION_get_available")) { | 3 | if(!function_exists("CS_REST_SERIALISATION_get_available")) { |
| 8 | function CS_REST_SERIALISATION_get_available($log) { | 4 | function CS_REST_SERIALISATION_get_available($log) { |
| 9 | $log->log_message('Getting serialiser', __FUNCTION__, CS_REST_LOG_VERBOSE); | 5 | $log->log_message('Getting serialiser', __FUNCTION__, CS_REST_LOG_VERBOSE); |
| ... | @@ -53,6 +49,7 @@ if (!class_exists('CS_REST_BaseSerialiser')) { | ... | @@ -53,6 +49,7 @@ if (!class_exists('CS_REST_BaseSerialiser')) { |
| 53 | 49 | ||
| 54 | if (!class_exists('CS_REST_DoNothingSerialiser')) { | 50 | if (!class_exists('CS_REST_DoNothingSerialiser')) { |
| 55 | class CS_REST_DoNothingSerialiser extends CS_REST_BaseSerialiser { | 51 | class CS_REST_DoNothingSerialiser extends CS_REST_BaseSerialiser { |
| 52 | function __construct() {} | ||
| 56 | function get_type() { return 'do_nothing'; } | 53 | function get_type() { return 'do_nothing'; } |
| 57 | function serialise($data) { return $data; } | 54 | function serialise($data) { return $data; } |
| 58 | function deserialise($text) { | 55 | function deserialise($text) { |
| ... | @@ -106,6 +103,10 @@ if (!class_exists('CS_REST_ServicesJsonSerialiser')) { | ... | @@ -106,6 +103,10 @@ if (!class_exists('CS_REST_ServicesJsonSerialiser')) { |
| 106 | 103 | ||
| 107 | function __construct($log) { | 104 | function __construct($log) { |
| 108 | parent::__construct($log); | 105 | parent::__construct($log); |
| 106 | if (!class_exists('Services_JSON', false)) { | ||
| 107 | require_once dirname(__FILE__).'/services_json.php'; | ||
| 108 | } | ||
| 109 | |||
| 109 | $this->_serialiser = new Services_JSON(); | 110 | $this->_serialiser = new Services_JSON(); |
| 110 | } | 111 | } |
| 111 | 112 | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -5,10 +5,10 @@ defined('CS_REST_POST') or define('CS_REST_POST', 'POST'); | ... | @@ -5,10 +5,10 @@ defined('CS_REST_POST') or define('CS_REST_POST', 'POST'); |
| 5 | defined('CS_REST_PUT') or define('CS_REST_PUT', 'PUT'); | 5 | defined('CS_REST_PUT') or define('CS_REST_PUT', 'PUT'); |
| 6 | defined('CS_REST_DELETE') or define('CS_REST_DELETE', 'DELETE'); | 6 | defined('CS_REST_DELETE') or define('CS_REST_DELETE', 'DELETE'); |
| 7 | if (false === defined('CS_REST_SOCKET_TIMEOUT')) { | 7 | if (false === defined('CS_REST_SOCKET_TIMEOUT')) { |
| 8 | define('CS_REST_SOCKET_TIMEOUT', 10); | 8 | define('CS_REST_SOCKET_TIMEOUT', 120); |
| 9 | } | 9 | } |
| 10 | if (false === defined('CS_REST_CALL_TIMEOUT')) { | 10 | if (false === defined('CS_REST_CALL_TIMEOUT')) { |
| 11 | define('CS_REST_CALL_TIMEOUT', 10); | 11 | define('CS_REST_CALL_TIMEOUT', 120); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | if(!function_exists("CS_REST_TRANSPORT_get_available")) { | 14 | if(!function_exists("CS_REST_TRANSPORT_get_available")) { | ... | ... |
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | "php": ">=5.3.0" | 16 | "php": ">=5.3.0" |
| 17 | }, | 17 | }, |
| 18 | "require-dev": { | 18 | "require-dev": { |
| 19 | "lastcraft/simpletest": "~1.1" | 19 | "simpletest/simpletest": "~1.1.3" |
| 20 | }, | 20 | }, |
| 21 | "autoload": { | 21 | "autoload": { |
| 22 | "classmap": [ | 22 | "classmap": [ |
| ... | @@ -24,6 +24,7 @@ | ... | @@ -24,6 +24,7 @@ |
| 24 | "csrest_campaigns.php", | 24 | "csrest_campaigns.php", |
| 25 | "csrest_clients.php", | 25 | "csrest_clients.php", |
| 26 | "csrest_general.php", | 26 | "csrest_general.php", |
| 27 | "csrest_events.php", | ||
| 27 | "csrest_lists.php", | 28 | "csrest_lists.php", |
| 28 | "csrest_people.php", | 29 | "csrest_people.php", |
| 29 | "csrest_segments.php", | 30 | "csrest_segments.php", |
| ... | @@ -31,8 +32,9 @@ | ... | @@ -31,8 +32,9 @@ |
| 31 | "csrest_templates.php", | 32 | "csrest_templates.php", |
| 32 | "csrest_transactional_classicemail.php", | 33 | "csrest_transactional_classicemail.php", |
| 33 | "csrest_transactional_smartemail.php", | 34 | "csrest_transactional_smartemail.php", |
| 34 | "csrest_transactional_timeline.php" | 35 | "csrest_transactional_timeline.php", |
| 35 | 36 | "csrest_journeys.php", | |
| 37 | "csrest_journey_emails.php" | ||
| 36 | ] | 38 | ] |
| 37 | } | 39 | } |
| 38 | } | 40 | } | ... | ... |
| 1 | { | 1 | { |
| 2 | "_readme": [ | 2 | "_readme": [ |
| 3 | "This file locks the dependencies of your project to a known state", | 3 | "This file locks the dependencies of your project to a known state", |
| 4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
| 5 | ], | 5 | "This file is @generated automatically" |
| 6 | "hash": "eccad7521596b5fe0d81af51ab2f16a1", | ||
| 7 | "packages": [ | ||
| 8 | |||
| 9 | ], | 6 | ], |
| 7 | "content-hash": "d6810a171a6fbbf05f7f1156b79fdd3d", | ||
| 8 | "packages": [], | ||
| 10 | "packages-dev": [ | 9 | "packages-dev": [ |
| 11 | { | 10 | { |
| 12 | "name": "lastcraft/simpletest", | 11 | "name": "simpletest/simpletest", |
| 13 | "version": "1.1.0", | 12 | "version": "v1.1.7", |
| 14 | "source": { | 13 | "source": { |
| 15 | "type": "git", | 14 | "type": "git", |
| 16 | "url": "https://github.com/lox/simpletest", | 15 | "url": "https://github.com/simpletest/simpletest.git", |
| 17 | "reference": "1.1.0" | 16 | "reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc" |
| 18 | }, | 17 | }, |
| 19 | "dist": { | 18 | "dist": { |
| 20 | "type": "zip", | 19 | "type": "zip", |
| 21 | "url": "https://github.com/lox/simpletest/zipball/1.1.0", | 20 | "url": "https://api.github.com/repos/simpletest/simpletest/zipball/2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc", |
| 22 | "reference": "1.1.0", | 21 | "reference": "2f8c466c114bdb9c11028a0c3e6d1380ae6a18dc", |
| 23 | "shasum": "" | 22 | "shasum": "" |
| 24 | }, | 23 | }, |
| 25 | "require": { | 24 | "require": { |
| 26 | "php": ">=5.0.5" | 25 | "php": ">=5.0.5" |
| 27 | }, | 26 | }, |
| 27 | "replace": { | ||
| 28 | "lastcraft/simpletest": "self.version", | ||
| 29 | "vierbergenlars/simpletest": "self.version" | ||
| 30 | }, | ||
| 28 | "type": "library", | 31 | "type": "library", |
| 32 | "autoload": { | ||
| 33 | "classmap": [ | ||
| 34 | "." | ||
| 35 | ] | ||
| 36 | }, | ||
| 29 | "notification-url": "https://packagist.org/downloads/", | 37 | "notification-url": "https://packagist.org/downloads/", |
| 30 | "license": [ | 38 | "license": [ |
| 31 | "LGPL-2.0+" | 39 | "LGPL-2.0+" |
| 32 | ], | 40 | ], |
| 33 | "authors": [ | 41 | "authors": [ |
| 34 | { | 42 | { |
| 43 | "name": "Lars Vierbergen", | ||
| 44 | "email": "vierbergenlars@gmail.com" | ||
| 45 | }, | ||
| 46 | { | ||
| 47 | "name": "Lachlan Donald", | ||
| 48 | "email": "lachlan@ljd.cc" | ||
| 49 | }, | ||
| 50 | { | ||
| 35 | "name": "Marcus Baker", | 51 | "name": "Marcus Baker", |
| 36 | "email": "marcus@lastcraft.com" | 52 | "email": "marcus@lastcraft.com", |
| 53 | "role": "Original project lead" | ||
| 54 | }, | ||
| 55 | { | ||
| 56 | "name": "Jason Sweat", | ||
| 57 | "role": "Original developer" | ||
| 58 | }, | ||
| 59 | { | ||
| 60 | "name": "Travis Swicegood", | ||
| 61 | "role": "Original developer" | ||
| 62 | }, | ||
| 63 | { | ||
| 64 | "name": "Perrick Penet", | ||
| 65 | "role": "Original developer" | ||
| 66 | }, | ||
| 67 | { | ||
| 68 | "name": "Edward Z. Yang", | ||
| 69 | "role": "Original developer" | ||
| 37 | } | 70 | } |
| 38 | ], | 71 | ], |
| 39 | "description": "Unit testing, mock objects and web testing framework for PHP built around test cases.", | 72 | "description": "Unit testing, mock objects and web testing framework for PHP built around test cases.", |
| 40 | "homepage": "http://simpletest.org/", | 73 | "homepage": "http://simpletest.org/", |
| 41 | "time": "2012-06-11 22:22:54" | 74 | "keywords": [ |
| 75 | "SimpleTest", | ||
| 76 | "code-coverage", | ||
| 77 | "selenium", | ||
| 78 | "testing", | ||
| 79 | "unit-test" | ||
| 80 | ], | ||
| 81 | "time": "2015-09-21T18:19:52+00:00" | ||
| 42 | } | 82 | } |
| 43 | ], | 83 | ], |
| 44 | "aliases": [ | 84 | "aliases": [], |
| 45 | |||
| 46 | ], | ||
| 47 | "minimum-stability": "stable", | 85 | "minimum-stability": "stable", |
| 48 | "stability-flags": [ | 86 | "stability-flags": [], |
| 49 | 87 | "prefer-stable": false, | |
| 50 | ], | 88 | "prefer-lowest": false, |
| 51 | "platform": { | 89 | "platform": { |
| 52 | "php": ">=5.3.0" | 90 | "php": ">=5.3.0" |
| 53 | }, | 91 | }, |
| 54 | "platform-dev": [ | 92 | "platform-dev": [] |
| 55 | |||
| 56 | ] | ||
| 57 | } | 93 | } | ... | ... |
| ... | @@ -191,7 +191,7 @@ if (!class_exists('CS_REST_Campaigns')) { | ... | @@ -191,7 +191,7 @@ if (!class_exists('CS_REST_Campaigns')) { |
| 191 | function get_recipients($page_number = NULL, $page_size = NULL, $order_field = NULL, | 191 | function get_recipients($page_number = NULL, $page_size = NULL, $order_field = NULL, |
| 192 | $order_direction = NULL) { | 192 | $order_direction = NULL) { |
| 193 | return $this->get_request_paged($this->_campaigns_base_route.'recipients.json', $page_number, | 193 | return $this->get_request_paged($this->_campaigns_base_route.'recipients.json', $page_number, |
| 194 | $page_size, $order_field, $order_direction, '?'); | 194 | $page_size, $order_field, $order_direction); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | /** | 197 | /** | ... | ... |
wp-content/plugins/tenzing-campaign-monitor/vendor/campaignmonitor/createsend-php/csrest_clients.php
| ... | @@ -420,7 +420,7 @@ if (!class_exists('CS_REST_Clients')) { | ... | @@ -420,7 +420,7 @@ if (!class_exists('CS_REST_Clients')) { |
| 420 | * returns the people associated with this client. | 420 | * returns the people associated with this client. |
| 421 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 421 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 422 | * array({ | 422 | * array({ |
| 423 | * 'EmailAddress' => the email address of the person | 423 | * 'EmailAddress' => the email address of the person |
| 424 | * 'Name' => the name of the person | 424 | * 'Name' => the name of the person |
| 425 | * 'AccessLevel' => the access level of the person | 425 | * 'AccessLevel' => the access level of the person |
| 426 | * 'Status' => the status of the person | 426 | * 'Status' => the status of the person |
| ... | @@ -448,5 +448,22 @@ if (!class_exists('CS_REST_Clients')) { | ... | @@ -448,5 +448,22 @@ if (!class_exists('CS_REST_Clients')) { |
| 448 | function set_primary_contact($emailAddress) { | 448 | function set_primary_contact($emailAddress) { |
| 449 | return $this->put_request($this->_clients_base_route.'primarycontact.json?email=' . urlencode($emailAddress), ''); | 449 | return $this->put_request($this->_clients_base_route.'primarycontact.json?email=' . urlencode($emailAddress), ''); |
| 450 | } | 450 | } |
| 451 | |||
| 452 | |||
| 453 | |||
| 454 | /** | ||
| 455 | * Gets a list of journeys for the current client | ||
| 456 | * @access public | ||
| 457 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | ||
| 458 | * array({ | ||
| 459 | * 'ListID' => The id of the list | ||
| 460 | * 'JourneyID' => The id of the journey | ||
| 461 | * 'Name' => Name of the journey | ||
| 462 | * 'Status' => Status of the journey | ||
| 463 | * }) | ||
| 464 | */ | ||
| 465 | function get_journeys() { | ||
| 466 | return $this->get_request($this->_clients_base_route.'journeys.json'); | ||
| 467 | } | ||
| 451 | } | 468 | } |
| 452 | } | 469 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
wp-content/plugins/tenzing-campaign-monitor/vendor/campaignmonitor/createsend-php/csrest_events.php
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
| 1 | <?php | ||
| 2 | require_once dirname(__FILE__).'/class/base_classes.php'; | ||
| 3 | |||
| 4 | /** | ||
| 5 | * Class to access a journey resource from the create send API. | ||
| 6 | * This class includes functions to retrieve journey information,such as summaries, | ||
| 7 | * recipients, opens, clicks etc. | ||
| 8 | * @author peterv | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | if (!class_exists('CS_REST_Journeys')) { | ||
| 13 | class CS_REST_Journeys extends CS_REST_Wrapper_Base { | ||
| 14 | |||
| 15 | /** | ||
| 16 | * The base route of the lists resource. | ||
| 17 | * @var string | ||
| 18 | * @access private | ||
| 19 | */ | ||
| 20 | var $_journeys_base_route; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Constructor. | ||
| 24 | * @param $journey_id string The journey id to access | ||
| 25 | * @param $auth_details array Authentication details to use for API calls. | ||
| 26 | * This array must take one of the following forms: | ||
| 27 | * If using OAuth to authenticate: | ||
| 28 | * array( | ||
| 29 | * 'access_token' => 'your access token', | ||
| 30 | * 'refresh_token' => 'your refresh token') | ||
| 31 | * | ||
| 32 | * Or if using an API key: | ||
| 33 | * array('api_key' => 'your api key') | ||
| 34 | * @param $protocol string The protocol to use for requests (http|https) | ||
| 35 | * @param $debug_level int The level of debugging required CS_REST_LOG_NONE | CS_REST_LOG_ERROR | CS_REST_LOG_WARNING | CS_REST_LOG_VERBOSE | ||
| 36 | * @param $host string The host to send API requests to. There is no need to change this | ||
| 37 | * @param $log CS_REST_Log The logger to use. Used for dependency injection | ||
| 38 | * @param $serialiser The serialiser to use. Used for dependency injection | ||
| 39 | * @param $transport The transport to use. Used for dependency injection | ||
| 40 | * @access public | ||
| 41 | */ | ||
| 42 | |||
| 43 | function __construct ( | ||
| 44 | $journey_id, | ||
| 45 | $auth_details, | ||
| 46 | $protocol = 'https', | ||
| 47 | $debug_level = CS_REST_LOG_NONE, | ||
| 48 | $host = 'api.createsend.com', | ||
| 49 | $log = NULL, | ||
| 50 | $serialiser = NULL, | ||
| 51 | $transport = NULL) { | ||
| 52 | |||
| 53 | parent::__construct($auth_details, $protocol, $debug_level, $host, $log, $serialiser, $transport); | ||
| 54 | $this->set_journey_id($journey_id); | ||
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | /** | ||
| 59 | * Change the email id used for calls after construction | ||
| 60 | * @param $email_id | ||
| 61 | * @access public | ||
| 62 | */ | ||
| 63 | function set_journey_id($journey_id) { | ||
| 64 | $this->_journeys_base_route = $this->_base_route.'journeys/'.$journey_id; | ||
| 65 | } | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Gets the details of the current journey | ||
| 69 | * @access public | ||
| 70 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | ||
| 71 | * { | ||
| 72 | * 'JourneyID' => The journey id | ||
| 73 | * 'Name' => The name of the journey | ||
| 74 | * 'TriggerType' => The method in which the journey was triggered | ||
| 75 | * 'Status' => The status of the journey | ||
| 76 | * 'Emails' => array( | ||
| 77 | * { | ||
| 78 | * 'EmailID' => The ID of the email attached to the journey | ||
| 79 | * 'Name' => The name of the email attached to the journey | ||
| 80 | * 'Bounced' => The number of recipients who bounced | ||
| 81 | * 'Clicked' => The total number of recorded clicks | ||
| 82 | * 'Opened' => The total number of recorded opens | ||
| 83 | * 'Sent' => The total recipients of the journey email | ||
| 84 | * 'UniqueOpened' => The number of recipients who opened | ||
| 85 | * 'Unsubscribed' => The number of recipients who unsubscribed | ||
| 86 | * } | ||
| 87 | * ) | ||
| 88 | * | ||
| 89 | */ | ||
| 90 | |||
| 91 | function get_journey_summary() { | ||
| 92 | return $this->get_request(trim($this->_journeys_base_route, '/').'.json'); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | } |
| ... | @@ -258,6 +258,7 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -258,6 +258,7 @@ if (!class_exists('CS_REST_Lists')) { |
| 258 | * @param int $page_size The number of records per page | 258 | * @param int $page_size The number of records per page |
| 259 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 259 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 260 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 260 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 261 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 261 | * @access public | 262 | * @access public |
| 262 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 263 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 263 | * { | 264 | * { |
| ... | @@ -285,10 +286,10 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -285,10 +286,10 @@ if (!class_exists('CS_REST_Lists')) { |
| 285 | * } | 286 | * } |
| 286 | */ | 287 | */ |
| 287 | function get_active_subscribers($added_since = '', $page_number = NULL, | 288 | function get_active_subscribers($added_since = '', $page_number = NULL, |
| 288 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 289 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 289 | 290 | ||
| 290 | return $this->get_request_paged($this->_lists_base_route.'active.json?date='.urlencode($added_since), | 291 | return $this->get_request_paged($this->_lists_base_route.'active.json?date='.urlencode($added_since), |
| 291 | $page_number, $page_size, $order_field, $order_direction); | 292 | $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref); |
| 292 | } | 293 | } |
| 293 | 294 | ||
| 294 | /** | 295 | /** |
| ... | @@ -298,6 +299,7 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -298,6 +299,7 @@ if (!class_exists('CS_REST_Lists')) { |
| 298 | * @param int $page_size The number of records per page | 299 | * @param int $page_size The number of records per page |
| 299 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 300 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 300 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 301 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 302 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 301 | * @access public | 303 | * @access public |
| 302 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 304 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 303 | * { | 305 | * { |
| ... | @@ -325,10 +327,10 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -325,10 +327,10 @@ if (!class_exists('CS_REST_Lists')) { |
| 325 | * } | 327 | * } |
| 326 | */ | 328 | */ |
| 327 | function get_unconfirmed_subscribers($added_since = '', $page_number = NULL, | 329 | function get_unconfirmed_subscribers($added_since = '', $page_number = NULL, |
| 328 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 330 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 329 | 331 | ||
| 330 | return $this->get_request_paged($this->_lists_base_route.'unconfirmed.json?date='.urlencode($added_since), | 332 | return $this->get_request_paged($this->_lists_base_route.'unconfirmed.json?date='.urlencode($added_since), |
| 331 | $page_number, $page_size, $order_field, $order_direction); | 333 | $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref); |
| 332 | } | 334 | } |
| 333 | 335 | ||
| 334 | /** | 336 | /** |
| ... | @@ -338,6 +340,7 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -338,6 +340,7 @@ if (!class_exists('CS_REST_Lists')) { |
| 338 | * @param int $page_size The number of records per page | 340 | * @param int $page_size The number of records per page |
| 339 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 341 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 340 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 342 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 343 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 341 | * @access public | 344 | * @access public |
| 342 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 345 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 343 | * { | 346 | * { |
| ... | @@ -365,10 +368,10 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -365,10 +368,10 @@ if (!class_exists('CS_REST_Lists')) { |
| 365 | * } | 368 | * } |
| 366 | */ | 369 | */ |
| 367 | function get_bounced_subscribers($bounced_since = '', $page_number = NULL, | 370 | function get_bounced_subscribers($bounced_since = '', $page_number = NULL, |
| 368 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 371 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 369 | 372 | ||
| 370 | return $this->get_request_paged($this->_lists_base_route.'bounced.json?date='.urlencode($bounced_since), | 373 | return $this->get_request_paged($this->_lists_base_route.'bounced.json?date='.urlencode($bounced_since), |
| 371 | $page_number, $page_size, $order_field, $order_direction); | 374 | $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref); |
| 372 | } | 375 | } |
| 373 | 376 | ||
| 374 | /** | 377 | /** |
| ... | @@ -378,6 +381,7 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -378,6 +381,7 @@ if (!class_exists('CS_REST_Lists')) { |
| 378 | * @param int $page_size The number of records per page | 381 | * @param int $page_size The number of records per page |
| 379 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 382 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 380 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 383 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 384 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 381 | * @access public | 385 | * @access public |
| 382 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 386 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 383 | * { | 387 | * { |
| ... | @@ -405,10 +409,10 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -405,10 +409,10 @@ if (!class_exists('CS_REST_Lists')) { |
| 405 | * } | 409 | * } |
| 406 | */ | 410 | */ |
| 407 | function get_unsubscribed_subscribers($unsubscribed_since = '', $page_number = NULL, | 411 | function get_unsubscribed_subscribers($unsubscribed_since = '', $page_number = NULL, |
| 408 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 412 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 409 | 413 | ||
| 410 | return $this->get_request_paged($this->_lists_base_route.'unsubscribed.json?date='.urlencode($unsubscribed_since), | 414 | return $this->get_request_paged($this->_lists_base_route.'unsubscribed.json?date='.urlencode($unsubscribed_since), |
| 411 | $page_number, $page_size, $order_field, $order_direction); | 415 | $page_number, $page_size, $order_field, $order_direction,$include_tracking_pref); |
| 412 | } | 416 | } |
| 413 | 417 | ||
| 414 | /** | 418 | /** |
| ... | @@ -418,6 +422,7 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -418,6 +422,7 @@ if (!class_exists('CS_REST_Lists')) { |
| 418 | * @param int $page_size The number of records per page | 422 | * @param int $page_size The number of records per page |
| 419 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 423 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 420 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 424 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 425 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 421 | * @access public | 426 | * @access public |
| 422 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 427 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 423 | * { | 428 | * { |
| ... | @@ -445,10 +450,10 @@ if (!class_exists('CS_REST_Lists')) { | ... | @@ -445,10 +450,10 @@ if (!class_exists('CS_REST_Lists')) { |
| 445 | * } | 450 | * } |
| 446 | */ | 451 | */ |
| 447 | function get_deleted_subscribers($deleted_since = '', $page_number = NULL, | 452 | function get_deleted_subscribers($deleted_since = '', $page_number = NULL, |
| 448 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 453 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 449 | 454 | ||
| 450 | return $this->get_request_paged($this->_lists_base_route.'deleted.json?date='.urlencode($deleted_since), | 455 | return $this->get_request_paged($this->_lists_base_route.'deleted.json?date='.urlencode($deleted_since), |
| 451 | $page_number, $page_size, $order_field, $order_direction); | 456 | $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref); |
| 452 | } | 457 | } |
| 453 | 458 | ||
| 454 | /** | 459 | /** | ... | ... |
| ... | @@ -172,6 +172,7 @@ if (!class_exists('CS_REST_Segments')) { | ... | @@ -172,6 +172,7 @@ if (!class_exists('CS_REST_Segments')) { |
| 172 | * @param int $page_size The number of records per page | 172 | * @param int $page_size The number of records per page |
| 173 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') | 173 | * @param string $order_field The field to order the record set by ('EMAIL', 'NAME', 'DATE') |
| 174 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') | 174 | * @param string $order_direction The direction to order the record set ('ASC', 'DESC') |
| 175 | * @param boolean $include_tracking_pref Whether or not to return the ConsentToTrack value (true, false) | ||
| 175 | * @access public | 176 | * @access public |
| 176 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form | 177 | * @return CS_REST_Wrapper_Result A successful response will be an object of the form |
| 177 | * { | 178 | * { |
| ... | @@ -199,10 +200,10 @@ if (!class_exists('CS_REST_Segments')) { | ... | @@ -199,10 +200,10 @@ if (!class_exists('CS_REST_Segments')) { |
| 199 | * } | 200 | * } |
| 200 | */ | 201 | */ |
| 201 | function get_subscribers($subscribed_since = '', $page_number = NULL, | 202 | function get_subscribers($subscribed_since = '', $page_number = NULL, |
| 202 | $page_size = NULL, $order_field = NULL, $order_direction = NULL) { | 203 | $page_size = NULL, $order_field = NULL, $order_direction = NULL, $include_tracking_pref = NULL) { |
| 203 | 204 | ||
| 204 | return $this->get_request_paged($this->_segments_base_route.'/active.json?date='.urlencode($subscribed_since), | 205 | return $this->get_request_paged($this->_segments_base_route.'/active.json?date='.urlencode($subscribed_since), |
| 205 | $page_number, $page_size, $order_field, $order_direction); | 206 | $page_number, $page_size, $order_field, $order_direction, $include_tracking_pref); |
| 206 | } | 207 | } |
| 207 | } | 208 | } |
| 208 | } | 209 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -75,6 +75,7 @@ if (!class_exists('CS_REST_Subscribers')) { | ... | @@ -75,6 +75,7 @@ if (!class_exists('CS_REST_Subscribers')) { |
| 75 | * 'Value' => The value for this subscriber | 75 | * 'Value' => The value for this subscriber |
| 76 | * ) | 76 | * ) |
| 77 | * ) | 77 | * ) |
| 78 | * 'ConsentToTrack' => Subscriber tracking preference ("yes", "no") | ||
| 78 | * 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list | 79 | * 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list |
| 79 | * 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list. | 80 | * 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list. |
| 80 | * ) | 81 | * ) |
| ... | @@ -102,6 +103,7 @@ if (!class_exists('CS_REST_Subscribers')) { | ... | @@ -102,6 +103,7 @@ if (!class_exists('CS_REST_Subscribers')) { |
| 102 | * 'Clear' => true/false (pass true to remove this custom field. in the case of a [multi-option, select many] field, pass an option in the 'Value' field to clear that option or leave Value blank to remove all options) | 103 | * 'Clear' => true/false (pass true to remove this custom field. in the case of a [multi-option, select many] field, pass an option in the 'Value' field to clear that option or leave Value blank to remove all options) |
| 103 | * ) | 104 | * ) |
| 104 | * ) | 105 | * ) |
| 106 | * 'ConsentToTrack' => Subscriber tracking preference ("yes", "no") | ||
| 105 | * 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list | 107 | * 'Resubscribe' => Whether we should resubscribe this subscriber if they already exist in the list |
| 106 | * 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list. | 108 | * 'RestartSubscriptionBasedAutoResponders' => Whether we should restart subscription based auto responders which are sent when the subscriber first subscribes to a list. |
| 107 | * ) | 109 | * ) |
| ... | @@ -177,8 +179,8 @@ if (!class_exists('CS_REST_Subscribers')) { | ... | @@ -177,8 +179,8 @@ if (!class_exists('CS_REST_Subscribers')) { |
| 177 | * ) | 179 | * ) |
| 178 | * } | 180 | * } |
| 179 | */ | 181 | */ |
| 180 | function get($email) { | 182 | function get($email, $include_tracking_pref = NULL) { |
| 181 | return $this->get_request($this->_subscribers_base_route.'.json?email='.urlencode($email)); | 183 | return $this->get_request($this->_subscribers_base_route.'.json?email='.urlencode($email), $include_tracking_pref); |
| 182 | } | 184 | } |
| 183 | 185 | ||
| 184 | /** | 186 | /** | ... | ... |
| ... | @@ -105,10 +105,15 @@ if (!class_exists('CS_REST_Transactional_ClassicEmail')) { | ... | @@ -105,10 +105,15 @@ if (!class_exists('CS_REST_Transactional_ClassicEmail')) { |
| 105 | * ) | 105 | * ) |
| 106 | * ) | 106 | * ) |
| 107 | */ | 107 | */ |
| 108 | function send($message, $group = NULL, $add_to_list_ID = NULL, $options = array()) { | 108 | function send($message, $group = NULL, $consent_to_track, $add_to_list_ID = NULL, $options = array()) { |
| 109 | $group_param = array( "Group" => $group); | 109 | $all_params = array( |
| 110 | $add_to_list_param = array( "AddRecipientsToListID" => $add_to_list_ID); | 110 | "Group" => $group, |
| 111 | $data = array_merge($this->_client_id_param, $message, $group_param, $add_to_list_param, $options); | 111 | "AddRecipientsToListID" => $add_to_list_ID, |
| 112 | "ConsentToTrack" => $consent_to_track | ||
| 113 | ); | ||
| 114 | $data = array_merge( | ||
| 115 | $this->_client_id_param, $message, $all_params, $options | ||
| 116 | ); | ||
| 112 | return $this->post_request($this->_base_route.'transactional/classicemail/send', $data); | 117 | return $this->post_request($this->_base_route.'transactional/classicemail/send', $data); |
| 113 | } | 118 | } |
| 114 | 119 | ... | ... |
| ... | @@ -140,8 +140,11 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) { | ... | @@ -140,8 +140,11 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) { |
| 140 | * ) | 140 | * ) |
| 141 | * ) | 141 | * ) |
| 142 | */ | 142 | */ |
| 143 | function send($message, $add_to_list = true) { | 143 | function send($message, $consent_to_track, $add_to_list = true) { |
| 144 | $data = array_merge($message, array("AddRecipientsToList" => $add_to_list)); | 144 | $data = array_merge($message, array( |
| 145 | "AddRecipientsToList" => $add_to_list, | ||
| 146 | "ConsentToTrack" => $consent_to_track | ||
| 147 | )); | ||
| 145 | return $this->post_request($this->_smartemail_base_route . '/send.json', $data); | 148 | return $this->post_request($this->_smartemail_base_route . '/send.json', $data); |
| 146 | } | 149 | } |
| 147 | 150 | ||
| ... | @@ -153,7 +156,7 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) { | ... | @@ -153,7 +156,7 @@ if (!class_exists('CS_REST_Transactional_SmartEmail')) { |
| 153 | * "SmartEmailID" => string | 156 | * "SmartEmailID" => string |
| 154 | * "Name" => string | 157 | * "Name" => string |
| 155 | * "CreatedAt" => string | 158 | * "CreatedAt" => string |
| 156 | * "Status" => stirng | 159 | * "Status" => string |
| 157 | * "Properties" => array ( | 160 | * "Properties" => array ( |
| 158 | * "From" =. string | 161 | * "From" =. string |
| 159 | * "ReplyTo" => string | 162 | * "ReplyTo" => string | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_clients.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_Clients( | ||
| 9 | 'ClientID to get Journeys for', | ||
| 10 | $auth); | ||
| 11 | |||
| 12 | $result = $wrap->get_journeys(); | ||
| 13 | |||
| 14 | echo "Result of /api/v3.2/clients/{id}/journeys\n<br />"; | ||
| 15 | if($result->was_successful()) { | ||
| 16 | echo "Got journeys\n<br /><pre>"; | ||
| 17 | var_dump($result->response); | ||
| 18 | } else { | ||
| 19 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 20 | var_dump($result->response); | ||
| 21 | } | ||
| 22 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | require_once "../../csrest_events.php"; | ||
| 3 | |||
| 4 | $auth = array("api_key" => "sample api key"); | ||
| 5 | $client_id = "sample client id"; | ||
| 6 | $api_event_type = "identify"; | ||
| 7 | $wrap = new CS_REST_Events($auth, $client_id, $api_event_type); | ||
| 8 | |||
| 9 | echo "\nSending a $api_event_type event...\n"; | ||
| 10 | |||
| 11 | $contact = "joe@example.org"; | ||
| 12 | $event_type = "checkout"; | ||
| 13 | $event_data = array( | ||
| 14 | "Page" => "/cart/checkout", | ||
| 15 | "Items" => array( | ||
| 16 | array( | ||
| 17 | "Description" => "Rubber Widget", | ||
| 18 | "Quantity" => 1, | ||
| 19 | "Price" => 300, | ||
| 20 | ), | ||
| 21 | array( | ||
| 22 | "Description" => "Paint 1L", | ||
| 23 | "Quantity" => 10, | ||
| 24 | "Price" => 1, | ||
| 25 | ), | ||
| 26 | ), | ||
| 27 | "User" => "joe@example.org", | ||
| 28 | "CardType" => "VISA", | ||
| 29 | ); | ||
| 30 | |||
| 31 | if (strcmp($wrap->getEventType(), "identify") === 0) { | ||
| 32 | // `Identify` event | ||
| 33 | $anon_id = "anonymousid-0"; | ||
| 34 | $user_id = "userid-0"; | ||
| 35 | $result = $wrap->track($contact, $event_type, $anon_id, $user_id, $event_data); | ||
| 36 | } else { | ||
| 37 | // `Non-identify` event (custom, shopify) | ||
| 38 | $result = $wrap->track($contact, $event_type, NULL, NULL, $event_data); | ||
| 39 | } | ||
| 40 | echo "\nEvent Sent! Here's the response:\n"; | ||
| 41 | var_dump($result); | ||
| 42 |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journey_emails.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_JourneyEmails('Email ID to get bounces for', $auth); | ||
| 9 | |||
| 10 | //$result = $wrap->get_journey_bounces(date('Y-m-d', strtotime('-30 days')), page, page size, order direction); | ||
| 11 | $result = $wrap->get_journey_bounces('Get bounces since', 1, 50, 'email', 'asc'); | ||
| 12 | |||
| 13 | echo "Result of GET /api/v3.2/journeys/email/{id}/bounces\n<br />"; | ||
| 14 | if($result->was_successful()) { | ||
| 15 | echo "Got bounces\n<br /><pre>"; | ||
| 16 | var_dump($result->response); | ||
| 17 | } else { | ||
| 18 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 19 | var_dump($result->response); | ||
| 20 | } | ||
| 21 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journey_emails.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_JourneyEmails('Email ID to get clicks for', $auth); | ||
| 9 | |||
| 10 | //$result = $wrap->get_journey_clicks(date('Y-m-d', strtotime('-30 days')), page, page size, order direction); | ||
| 11 | $result = $wrap->get_journey_clicks('Get clicks since', 1, 50, 'email', 'asc'); | ||
| 12 | |||
| 13 | echo "Result of GET /api/v3.2/journeys/email/{id}/clicks\n<br />"; | ||
| 14 | if($result->was_successful()) { | ||
| 15 | echo "Got clicks\n<br /><pre>"; | ||
| 16 | var_dump($result->response); | ||
| 17 | } else { | ||
| 18 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 19 | var_dump($result->response); | ||
| 20 | } | ||
| 21 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journey_emails.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_JourneyEmails('Email ID to get opens for', $auth); | ||
| 9 | |||
| 10 | //$result = $wrap->get_journey_opens(date('Y-m-d', strtotime('-30 days')), page, page size, order direction); | ||
| 11 | $result = $wrap->get_journey_opens('Get opens since', 1, 50, 'email', 'asc'); | ||
| 12 | |||
| 13 | echo "Result of GET /api/v3.2/journeys/email/{id}/opens\n<br />"; | ||
| 14 | if($result->was_successful()) { | ||
| 15 | echo "Got opens\n<br /><pre>"; | ||
| 16 | var_dump($result->response); | ||
| 17 | } else { | ||
| 18 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 19 | var_dump($result->response); | ||
| 20 | } | ||
| 21 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journey_emails.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_JourneyEmails('Email ID to get recipients for', $auth); | ||
| 9 | |||
| 10 | //$result = $wrap->get_journey_recipients(date('Y-m-d', strtotime('-30 days')), page, page size, order direction); | ||
| 11 | $result = $wrap->get_journey_recipients('Get recipients since', 1, 50, 'email', 'asc'); | ||
| 12 | |||
| 13 | echo "Result of GET /api/v3.2/journeys/email/{id}/recipients\n<br />"; | ||
| 14 | if($result->was_successful()) { | ||
| 15 | echo "Got recipients\n<br /><pre>"; | ||
| 16 | var_dump($result->response); | ||
| 17 | } else { | ||
| 18 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 19 | var_dump($result->response); | ||
| 20 | } | ||
| 21 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journeys.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_Journeys('Journey ID to get the summary of', $auth); | ||
| 9 | $result = $wrap->get_summary(); | ||
| 10 | |||
| 11 | echo "Result of GET /api/v3.2/journeys/{id}\n<br />"; | ||
| 12 | if($result->was_successful()) { | ||
| 13 | echo "Got summary\n<br /><pre>"; | ||
| 14 | var_dump($result->response); | ||
| 15 | } else { | ||
| 16 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 17 | var_dump($result->response); | ||
| 18 | } | ||
| 19 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once '../../csrest_journey_emails.php'; | ||
| 4 | |||
| 5 | $auth = array( | ||
| 6 | 'access_token' => 'your access token', | ||
| 7 | 'refresh_token' => 'your refresh token'); | ||
| 8 | $wrap = new CS_REST_JourneyEmails('Email ID to get unsubscribes for', $auth); | ||
| 9 | |||
| 10 | //$result = $wrap->get_journey_unsubscribes(date('Y-m-d', strtotime('-30 days')), page, page size, order direction); | ||
| 11 | $result = $wrap->get_journey_unsubscribes('Get unsubscribes since', 1, 50, 'email', 'asc'); | ||
| 12 | |||
| 13 | echo "Result of GET /api/v3.2/journeys/email/{id}/unsubscribes\n<br />"; | ||
| 14 | if($result->was_successful()) { | ||
| 15 | echo "Got unsubscribes\n<br /><pre>"; | ||
| 16 | var_dump($result->response); | ||
| 17 | } else { | ||
| 18 | echo 'Failed with code '.$result->http_status_code."\n<br /><pre>"; | ||
| 19 | var_dump($result->response); | ||
| 20 | } | ||
| 21 | echo '</pre>'; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -7,7 +7,9 @@ $auth = array( | ... | @@ -7,7 +7,9 @@ $auth = array( |
| 7 | 'refresh_token' => 'your refresh token'); | 7 | 'refresh_token' => 'your refresh token'); |
| 8 | $wrap = new CS_REST_Lists('List ID', $auth); | 8 | $wrap = new CS_REST_Lists('List ID', $auth); |
| 9 | 9 | ||
| 10 | $result = $wrap->get_active_subscribers('Added since', 1, 50, 'email', 'asc'); | 10 | //The 6th argument will return the tracking preference of the subscribers - 'ConsentToTrack' |
| 11 | $result = $wrap->get_active_subscribers('Added since', 1, 50, 'email', 'asc', true); | ||
| 12 | |||
| 11 | //$result = $wrap->get_active_subscribers(date('Y-m-d', strtotime('-30 days')), | 13 | //$result = $wrap->get_active_subscribers(date('Y-m-d', strtotime('-30 days')), |
| 12 | // page number, page size, order by, order direction); | 14 | // page number, page size, order by, order direction); |
| 13 | 15 | ... | ... |
| ... | @@ -7,7 +7,9 @@ $auth = array( | ... | @@ -7,7 +7,9 @@ $auth = array( |
| 7 | 'refresh_token' => 'your refresh token'); | 7 | 'refresh_token' => 'your refresh token'); |
| 8 | $wrap = new CS_REST_Segments('Segment ID', $auth); | 8 | $wrap = new CS_REST_Segments('Segment ID', $auth); |
| 9 | 9 | ||
| 10 | $result = $wrap->get_subscribers('Added since', 1, 50, 'email', 'asc'); | 10 | //The 6th argument will return the tracking preference of the subscribers - 'ConsentToTrack' |
| 11 | $result = $wrap->get_subscribers('Added since', 1, 50, 'email', 'asc', true); | ||
| 12 | |||
| 11 | //$result = $wrap->get_subscribers(date('Y-m-d', strtotime('-30 days')), | 13 | //$result = $wrap->get_subscribers(date('Y-m-d', strtotime('-30 days')), |
| 12 | // page number, page size, order by, order description); | 14 | // page number, page size, order by, order description); |
| 13 | 15 | ... | ... |
| ... | @@ -6,7 +6,9 @@ $auth = array( | ... | @@ -6,7 +6,9 @@ $auth = array( |
| 6 | 'access_token' => 'your access token', | 6 | 'access_token' => 'your access token', |
| 7 | 'refresh_token' => 'your refresh token'); | 7 | 'refresh_token' => 'your refresh token'); |
| 8 | $wrap = new CS_REST_Subscribers('Your list ID', $auth); | 8 | $wrap = new CS_REST_Subscribers('Your list ID', $auth); |
| 9 | $result = $wrap->get('Email address'); | 9 | |
| 10 | //The 2nd argument will return the tracking preference of the subscriber - 'ConsentToTrack' | ||
| 11 | $result = $wrap->get('Email address', true); | ||
| 10 | 12 | ||
| 11 | echo "Result of GET /api/v3.1/subscribers/{list id}.{format}?email={email}\n<br />"; | 13 | echo "Result of GET /api/v3.1/subscribers/{list id}.{format}?email={email}\n<br />"; |
| 12 | if($result->was_successful()) { | 14 | if($result->was_successful()) { | ... | ... |
| ... | @@ -15,6 +15,7 @@ $result = $wrap->update('Old Email Address', array( | ... | @@ -15,6 +15,7 @@ $result = $wrap->update('Old Email Address', array( |
| 15 | 'Value' => 'Field Value' | 15 | 'Value' => 'Field Value' |
| 16 | ) | 16 | ) |
| 17 | ), | 17 | ), |
| 18 | 'ConsentToTrack' => 'unchanged', | ||
| 18 | 'Resubscribe' => true | 19 | 'Resubscribe' => true |
| 19 | )); | 20 | )); |
| 20 | 21 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | require_once "../../csrest_transactional_classicemail.php"; | 2 | require_once "../../csrest_transactional_classicemail.php"; |
| 3 | 3 | ||
| 4 | $client_id = "Your Client ID"; | ||
| 4 | $auth = array("api_key" => "Your API Key"); | 5 | $auth = array("api_key" => "Your API Key"); |
| 5 | $wrap = new CS_REST_Transactional_ClassicEmail($auth); | 6 | |
| 7 | $wrap = new CS_REST_Transactional_ClassicEmail($auth, $client_id); | ||
| 6 | 8 | ||
| 7 | echo "Get the list of classic groups...\n"; | 9 | echo "Get the list of classic groups...\n"; |
| 8 | $result = $wrap->groups(); | 10 | $result = $wrap->groups(); | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | require_once "../../csrest_transactional_classicemail.php"; | 2 | require_once "../../csrest_transactional_classicemail.php"; |
| 3 | 3 | ||
| 4 | $client_id = "Your Client ID"; | ||
| 4 | $auth = array("api_key" => "Your API Key"); | 5 | $auth = array("api_key" => "Your API Key"); |
| 5 | $wrap = new CS_REST_Transactional_ClassicEmail($auth, NULL); | 6 | $wrap = new CS_REST_Transactional_ClassicEmail($auth, $client_id); |
| 6 | 7 | ||
| 7 | echo "\nSending a simple message...\n"; | 8 | echo "\nSending a simple message...\n"; |
| 8 | 9 | ||
| ... | @@ -13,11 +14,12 @@ $simple_message = array( | ... | @@ -13,11 +14,12 @@ $simple_message = array( |
| 13 | "HTML" => "This is the HTML message body with a <a href='http://google.com'>link</a>." | 14 | "HTML" => "This is the HTML message body with a <a href='http://google.com'>link</a>." |
| 14 | ); | 15 | ); |
| 15 | $group_name = 'PHP test group'; # optional but great for reporting, should not be unique per message | 16 | $group_name = 'PHP test group'; # optional but great for reporting, should not be unique per message |
| 16 | $result = $wrap->send($simple_message, $group_name); | 17 | $consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged' |
| 18 | |||
| 19 | $result = $wrap->send($simple_message, $group_name,$consent_to_track); | ||
| 17 | echo "\nSent! Here's the response:\n"; | 20 | echo "\nSent! Here's the response:\n"; |
| 18 | var_dump($result->response); | 21 | var_dump($result->response); |
| 19 | 22 | ||
| 20 | |||
| 21 | echo "\nSending a message with all the options...\n"; | 23 | echo "\nSending a message with all the options...\n"; |
| 22 | 24 | ||
| 23 | $complex_message = array( | 25 | $complex_message = array( |
| ... | @@ -48,12 +50,14 @@ $complex_message = array( | ... | @@ -48,12 +50,14 @@ $complex_message = array( |
| 48 | ); | 50 | ); |
| 49 | $group_name = "PHP test group"; # optional, great for reporting, should not be unique message | 51 | $group_name = "PHP test group"; # optional, great for reporting, should not be unique message |
| 50 | $add_recipients_to_subscriber_list_ID = "6d0366fcee146ab9bdaf3247446bbfdd"; # optional, make sure you have permission | 52 | $add_recipients_to_subscriber_list_ID = "6d0366fcee146ab9bdaf3247446bbfdd"; # optional, make sure you have permission |
| 53 | $consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged' | ||
| 54 | |||
| 51 | $options = array( | 55 | $options = array( |
| 52 | "TrackOpens" => true, | 56 | "TrackOpens" => true, |
| 53 | "TrackClicks" => true, | 57 | "TrackClicks" => true, |
| 54 | "InlineCSS" => true, | 58 | "InlineCSS" => true, |
| 55 | ); # all are true by default, but you can override | 59 | ); # all are true by default, but you can override |
| 56 | $result = $wrap->send($complex_message, $group_name, $add_recipients_to_subscriber_list_ID, $options); | 60 | $result = $wrap->send($complex_message, $group_name, $consent_to_track, $add_recipients_to_subscriber_list_ID, $options); |
| 57 | echo "\nSent! Here's the response:\n"; | 61 | echo "\nSent! Here's the response:\n"; |
| 58 | var_dump($result->response); | 62 | var_dump($result->response); |
| 59 | 63 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | require_once "../../csrest_transactional_smartemail.php"; | 2 | require_once "../../csrest_transactional_smartemail.php"; |
| 3 | 3 | ||
| 4 | $client_id = "Your Client ID"; | ||
| 4 | $auth = array("api_key" => "Your API Key"); | 5 | $auth = array("api_key" => "Your API Key"); |
| 5 | $wrap = new CS_REST_Transactional_SmartEmail(NULL, $auth); | 6 | $wrap = new CS_REST_Transactional_SmartEmail(NULL, $auth, $client_id); |
| 6 | 7 | ||
| 7 | echo "\nGetting the list of smart emails...\n"; | 8 | echo "\nGetting the list of smart emails...\n"; |
| 8 | 9 | ... | ... |
| ... | @@ -13,7 +13,8 @@ $simple_message = array( | ... | @@ -13,7 +13,8 @@ $simple_message = array( |
| 13 | "username" => "janebloggs" | 13 | "username" => "janebloggs" |
| 14 | ), | 14 | ), |
| 15 | ); | 15 | ); |
| 16 | $result = $wrap->send($simple_message); | 16 | $consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged' |
| 17 | $result = $wrap->send($simple_message, $consent_to_track); | ||
| 17 | echo "\nSent! Here's the response:\n"; | 18 | echo "\nSent! Here's the response:\n"; |
| 18 | var_dump($result->response); | 19 | var_dump($result->response); |
| 19 | 20 | ||
| ... | @@ -47,7 +48,9 @@ $complex_message = array( | ... | @@ -47,7 +48,9 @@ $complex_message = array( |
| 47 | ); | 48 | ); |
| 48 | 49 | ||
| 49 | $add_recipients_to_subscriber_list = true; | 50 | $add_recipients_to_subscriber_list = true; |
| 50 | $result = $wrap->send($complex_message, $add_recipients_to_subscriber_list); | 51 | $consent_to_track = 'yes'; # Valid: 'yes', 'no', 'unchanged' |
| 52 | |||
| 53 | $result = $wrap->send($complex_message, $consent_to_track, $add_recipients_to_subscriber_list); | ||
| 51 | echo "\nSent! Here's the response:\n"; | 54 | echo "\nSent! Here's the response:\n"; |
| 52 | var_dump($result->response); | 55 | var_dump($result->response); |
| 53 | 56 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | require_once "../../csrest_transactional_timeline.php"; | 2 | require_once "../../csrest_transactional_timeline.php"; |
| 3 | 3 | ||
| 4 | $client_id = "Your Client ID"; | ||
| 4 | $auth = array("api_key" => "Your API Key"); | 5 | $auth = array("api_key" => "Your API Key"); |
| 5 | $wrap = new CS_REST_Transactional_Timeline($auth); | 6 | $wrap = new CS_REST_Transactional_Timeline($auth, $client_id); |
| 6 | 7 | ||
| 7 | 8 | ||
| 8 | echo "\nGetting the statistics with the default parameters...\n"; | 9 | echo "\nGetting the statistics with the default parameters...\n"; | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | require_once __DIR__.'/../vendor/autoload.php'; | 2 | require_once __DIR__.'/../vendor/autoload.php'; |
| 3 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 3 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/mock_objects.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/mock_objects.php'; |
| 5 | 5 | ||
| 6 | class AllTests extends TestSuite { | 6 | class AllTests extends TestSuite { |
| 7 | function AllTests() { | 7 | function __construct() { |
| 8 | $this->TestSuite('All Tests'); | 8 | parent::__construct('All Tests'); |
| 9 | $this->addFile('class_tests/transport_test.php'); | 9 | $this->addFile('class_tests/transport_test.php'); |
| 10 | $this->addFile('class_tests/response_tests.php'); | 10 | $this->addFile('class_tests/response_tests.php'); |
| 11 | $this->addFile('csrest_test.php'); | 11 | $this->addFile('csrest_test.php'); |
| ... | @@ -17,5 +17,8 @@ class AllTests extends TestSuite { | ... | @@ -17,5 +17,8 @@ class AllTests extends TestSuite { |
| 17 | $this->addFile('csrest_segments_test.php'); | 17 | $this->addFile('csrest_segments_test.php'); |
| 18 | $this->addFile('csrest_people_test.php'); | 18 | $this->addFile('csrest_people_test.php'); |
| 19 | $this->addFile('csrest_administrators_test.php'); | 19 | $this->addFile('csrest_administrators_test.php'); |
| 20 | $this->addFile('csrest_events_test.php'); | ||
| 21 | $this->addFile('csrest_journeys_test.php'); | ||
| 22 | $this->addFile('csrest_journey_emails_test.php'); | ||
| 20 | } | 23 | } |
| 21 | } | 24 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../../vendor/autoload.php'; | 3 | require_once __DIR__.'/../../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../../vendor/simpletest/simpletest/autorun.php'; |
| 5 | require_once '../class/serialisation.php'; | 5 | require_once '../class/serialisation.php'; |
| 6 | require_once '../class/log.php'; | 6 | require_once '../class/log.php'; |
| 7 | 7 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../../vendor/autoload.php'; | 3 | require_once __DIR__.'/../../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../../vendor/simpletest/simpletest/autorun.php'; |
| 5 | require_once '../class/transport.php'; | 5 | require_once '../class/transport.php'; |
| 6 | require_once '../class/log.php'; | 6 | require_once '../class/log.php'; |
| 7 | 7 | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); |
| ... | @@ -35,6 +35,14 @@ abstract class CS_REST_TestClients extends CS_REST_TestBase { | ... | @@ -35,6 +35,14 @@ abstract class CS_REST_TestClients extends CS_REST_TestBase { |
| 35 | $this->general_test('get_campaigns', $call_options, $raw_result, $deserialised); | 35 | $this->general_test('get_campaigns', $call_options, $raw_result, $deserialised); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | function testget_journeys() { | ||
| 39 | $raw_result = 'some journeys'; | ||
| 40 | $deserialised = array('Journey 1', 'Journey 2'); | ||
| 41 | $call_options = $this->get_call_options($this->client_base_route.'journeys.json'); | ||
| 42 | |||
| 43 | $this->general_test('get_journeys', $call_options, $raw_result, $deserialised); | ||
| 44 | } | ||
| 45 | |||
| 38 | function testget_scheduled() { | 46 | function testget_scheduled() { |
| 39 | $raw_result = 'some scheduled campaigns'; | 47 | $raw_result = 'some scheduled campaigns'; |
| 40 | $deserialised = array('Campaign 1', 'Campaign 2'); | 48 | $deserialised = array('Campaign 1', 'Campaign 2'); | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | ||
| 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; | ||
| 5 | |||
| 6 | @Mock::generate('CS_REST_Log'); | ||
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ||
| 8 | @Mock::generate('CS_REST_CurlTransport'); | ||
| 9 | |||
| 10 | class CS_REST_ApiKeyTestEvents extends CS_REST_TestEvents { | ||
| 11 | var $auth = array('api_key' => 'not a real api key'); | ||
| 12 | } | ||
| 13 | |||
| 14 | class CS_REST_OAuthTestEvents extends CS_REST_TestEvents { | ||
| 15 | var $auth = array( | ||
| 16 | 'access_token' => '7y872y3872i3eh', | ||
| 17 | 'refresh_token' => 'kjw8qjd9ow8jo'); | ||
| 18 | } | ||
| 19 | |||
| 20 | abstract class CS_REST_TestEvents extends CS_REST_TestBase { | ||
| 21 | var $client_id = 'fakeclientid'; | ||
| 22 | var $events_base_route; | ||
| 23 | var $event_type = "identify"; | ||
| 24 | |||
| 25 | function set_up_inner() { | ||
| 26 | $this->events_base_route = $this->base_route.'events/'.$this->client_id.'/'; | ||
| 27 | $this->wrapper = new CS_REST_Events($this->auth, $this->client_id, $this->event_type, $this->protocol, | ||
| 28 | $this->log_level, $this->api_host, $this->mock_log, | ||
| 29 | $this->mock_serialiser, $this->mock_transport); | ||
| 30 | } | ||
| 31 | |||
| 32 | function testtrack() { | ||
| 33 | $client_id = 'fakeclientid'; | ||
| 34 | $raw_result = 'the new event id'; | ||
| 35 | $email = 'test@email.com'; | ||
| 36 | $event_name = 'Widget Man!'; | ||
| 37 | $data = array('ExampleField'=> 'Me'); | ||
| 38 | $anon_id = 'anonid-0'; | ||
| 39 | $user_id = 'userid-0'; | ||
| 40 | $response_code = 202; | ||
| 41 | |||
| 42 | $call_options = $this->get_call_options($this->base_route.'events/'.$this->event_type.'/'.$this->client_id.'/track', 'POST'); | ||
| 43 | |||
| 44 | // `Non-identify` event (custom, shopify) | ||
| 45 | $event_info = array ( | ||
| 46 | 'ContactID' => array( | ||
| 47 | 'Email' => 'test@email.com', | ||
| 48 | ), | ||
| 49 | 'EventName' => $event_name, | ||
| 50 | 'Data' => array( | ||
| 51 | 'ExampleField'=> 'Me' | ||
| 52 | ) | ||
| 53 | ); | ||
| 54 | |||
| 55 | if (strcmp($this->event_type, "identify") === 0) { | ||
| 56 | // `Identify` event | ||
| 57 | $event_info['ContactID']['AnonymousID'] = $anon_id; | ||
| 58 | $event_info['ContactID']['UserID'] = $user_id; | ||
| 59 | } | ||
| 60 | |||
| 61 | $transport_result = array ( | ||
| 62 | 'code' => $response_code, | ||
| 63 | 'response' => $raw_result | ||
| 64 | ); | ||
| 65 | |||
| 66 | $expected_result = new CS_REST_Wrapper_Result($raw_result, $response_code); | ||
| 67 | |||
| 68 | $call_options['data'] = 'event info was serialised to this'; | ||
| 69 | |||
| 70 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 71 | $raw_result, $raw_result, 'event info was serialised to this', $event_info, $response_code); | ||
| 72 | |||
| 73 | if (strcmp($this->event_type, "identify") == 0) { | ||
| 74 | $result = $this->wrapper->track($email, $event_name, $anon_id, $user_id, $data); | ||
| 75 | } else { | ||
| 76 | $result = $this->wrapper->track($email, $event_name, NULL, NULL, $data); | ||
| 77 | } | ||
| 78 | |||
| 79 | $this->assertIdentical($expected_result, $result); | ||
| 80 | |||
| 81 | } | ||
| 82 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | ||
| 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; | ||
| 5 | |||
| 6 | @Mock::generate('CS_REST_Log'); | ||
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ||
| 8 | @Mock::generate('CS_REST_CurlTransport'); | ||
| 9 | |||
| 10 | class CS_REST_ApiKeyTestJourneyEmails extends CS_REST_TestJourneyEmails { | ||
| 11 | var $auth = array('api_key' => 'not a real api key'); | ||
| 12 | } | ||
| 13 | |||
| 14 | class CS_REST_OAuthTestJourneyEmails extends CS_REST_TestJourneyEmails { | ||
| 15 | var $auth = array( | ||
| 16 | 'access_token' => '7y872y3872i3eh', | ||
| 17 | 'refresh_token' => 'kjw8qjd9ow8jo'); | ||
| 18 | } | ||
| 19 | |||
| 20 | abstract class CS_REST_TestJourneyEmails extends CS_REST_TestBase { | ||
| 21 | var $journey_email_id = 'not a real email id'; | ||
| 22 | var $journey_emails_base_route; | ||
| 23 | |||
| 24 | function set_up_inner() { | ||
| 25 | $this->journey_emails_base_route = $this->base_route.'journeys/email/'.$this->journey_email_id.'/'; | ||
| 26 | $this->wrapper = new CS_REST_JourneyEmails($this->journey_email_id, $this->auth, $this->protocol, $this->log_level, | ||
| 27 | $this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport); | ||
| 28 | |||
| 29 | } | ||
| 30 | |||
| 31 | function testget_journey_recipients() { | ||
| 32 | $raw_result = 'some recipients'; | ||
| 33 | $since = '2021'; | ||
| 34 | $response_code = 200; | ||
| 35 | $deserialised = array('Recipient 1', 'Recipient 2'); | ||
| 36 | $call_options = $this->get_call_options( | ||
| 37 | $this->journey_emails_base_route.'opens.json?date='.$since); | ||
| 38 | |||
| 39 | $transport_result = array ( | ||
| 40 | 'code' => $response_code, | ||
| 41 | 'response' => $raw_result | ||
| 42 | ); | ||
| 43 | |||
| 44 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 45 | |||
| 46 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 47 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 48 | |||
| 49 | $result = $this->wrapper->get_journey_opens($since); | ||
| 50 | |||
| 51 | $this->assertIdentical($expected_result, $result); | ||
| 52 | |||
| 53 | |||
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | function testget_journey_opens() { | ||
| 59 | $raw_result = 'some journey opens'; | ||
| 60 | $since = '2021'; | ||
| 61 | $response_code = 200; | ||
| 62 | $deserialised = array('Journey Open 1', 'Journey Open 2'); | ||
| 63 | $call_options = $this->get_call_options( | ||
| 64 | $this->journey_emails_base_route.'opens.json?date='.$since); | ||
| 65 | |||
| 66 | $transport_result = array ( | ||
| 67 | 'code' => $response_code, | ||
| 68 | 'response' => $raw_result | ||
| 69 | ); | ||
| 70 | |||
| 71 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 72 | |||
| 73 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 74 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 75 | |||
| 76 | $result = $this->wrapper->get_journey_opens($since); | ||
| 77 | |||
| 78 | $this->assertIdentical($expected_result, $result); | ||
| 79 | } | ||
| 80 | |||
| 81 | |||
| 82 | function testget_journey_clicks() { | ||
| 83 | $raw_result = 'some journey clicks'; | ||
| 84 | $since = '2021'; | ||
| 85 | $response_code = 200; | ||
| 86 | $deserialised = array('Journey Click 1', 'Journey Click 2'); | ||
| 87 | $call_options = $this->get_call_options( | ||
| 88 | $this->journey_emails_base_route.'clicks.json?date='.$since); | ||
| 89 | |||
| 90 | $transport_result = array ( | ||
| 91 | 'code' => $response_code, | ||
| 92 | 'response' => $raw_result | ||
| 93 | ); | ||
| 94 | |||
| 95 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 96 | |||
| 97 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 98 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 99 | |||
| 100 | $result = $this->wrapper->get_journey_clicks($since); | ||
| 101 | |||
| 102 | $this->assertIdentical($expected_result, $result); | ||
| 103 | } | ||
| 104 | |||
| 105 | |||
| 106 | function testget_journey_unsubscribes() { | ||
| 107 | $raw_result = 'some journey clicks'; | ||
| 108 | $since = '2021'; | ||
| 109 | $response_code = 200; | ||
| 110 | $deserialised = array('Journey Unsub 1','Journey Unsub 2'); | ||
| 111 | $call_options = $this->get_call_options( | ||
| 112 | $this->journey_emails_base_route.'unsubscribes.json?date='.$since); | ||
| 113 | |||
| 114 | $transport_result = array ( | ||
| 115 | 'code' => $response_code, | ||
| 116 | 'response' => $raw_result | ||
| 117 | ); | ||
| 118 | |||
| 119 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 120 | |||
| 121 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 122 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 123 | |||
| 124 | $result = $this->wrapper->get_journey_unsubscribes($since); | ||
| 125 | |||
| 126 | $this->assertIdentical($expected_result, $result); | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | function testget_journey_bounces() { | ||
| 132 | $raw_result = 'some journey bounces'; | ||
| 133 | $since = '2021'; | ||
| 134 | $response_code = 200; | ||
| 135 | $deserialised = array('Journey Bounce 1','Journey Bounce 2'); | ||
| 136 | $call_options = $this->get_call_options( | ||
| 137 | $this->journey_emails_base_route.'bounces.json?date='.$since); | ||
| 138 | |||
| 139 | $transport_result = array ( | ||
| 140 | 'code' => $response_code, | ||
| 141 | 'response' => $raw_result | ||
| 142 | ); | ||
| 143 | |||
| 144 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 145 | |||
| 146 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 147 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 148 | |||
| 149 | $result = $this->wrapper->get_journey_bounces($since); | ||
| 150 | |||
| 151 | $this->assertIdentical($expected_result, $result); | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | |||
| 156 | |||
| 157 | |||
| 158 | |||
| 159 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | ||
| 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; | ||
| 5 | |||
| 6 | @Mock::generate('CS_REST_Log'); | ||
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ||
| 8 | @Mock::generate('CS_REST_CurlTransport'); | ||
| 9 | |||
| 10 | class CS_REST_ApiKeyTestJourneys extends CS_REST_TestJourneys { | ||
| 11 | var $auth = array('api_key' => 'not a real api key'); | ||
| 12 | } | ||
| 13 | |||
| 14 | class CS_REST_OAuthTestJourneys extends CS_REST_TestJourneys { | ||
| 15 | var $auth = array( | ||
| 16 | 'access_token' => '7y872y3872i3eh', | ||
| 17 | 'refresh_token' => 'kjw8qjd9ow8jo'); | ||
| 18 | } | ||
| 19 | |||
| 20 | abstract class CS_REST_TestJourneys extends CS_REST_TestBase { | ||
| 21 | var $journey_id = 'not a real journey id'; | ||
| 22 | var $journey_base_route; | ||
| 23 | |||
| 24 | function set_up_inner() { | ||
| 25 | $this->journey_base_route = $this->base_route.'journeys/'.$this->journey_id.'/'; | ||
| 26 | $this->wrapper = new CS_REST_Journeys($this->journey_id, $this->auth, $this->protocol, $this->log_level, | ||
| 27 | $this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport); | ||
| 28 | |||
| 29 | } | ||
| 30 | |||
| 31 | function testget_journey_summary() { | ||
| 32 | |||
| 33 | $raw_result = 'journey details'; | ||
| 34 | $deserialised = array(1,23,4,5); | ||
| 35 | $call_options = $this->get_call_options(trim($this->journey_base_route, '/').'.json'); | ||
| 36 | $this->general_test('get_journey_summary', $call_options, $raw_result, $deserialised); | ||
| 37 | } | ||
| 38 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); |
| ... | @@ -276,6 +276,31 @@ abstract class CS_REST_TestLists extends CS_REST_TestBase { | ... | @@ -276,6 +276,31 @@ abstract class CS_REST_TestLists extends CS_REST_TestBase { |
| 276 | $this->assertIdentical($expected_result, $result); | 276 | $this->assertIdentical($expected_result, $result); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | function testget_active_tracking() { | ||
| 280 | $raw_result = 'some subscribers'; | ||
| 281 | $since = '2020'; | ||
| 282 | $response_code = 200; | ||
| 283 | $deserialised = array('Subscriber 1', 'Subscriber 2'); | ||
| 284 | $tracking_pref = 'true'; | ||
| 285 | |||
| 286 | $call_options = $this->get_call_options($this->list_base_route.'active.json?date='.$since.'&includeTrackingPreference='.$tracking_pref); | ||
| 287 | |||
| 288 | $transport_result = array ( | ||
| 289 | 'code' => $response_code, | ||
| 290 | 'response' => $raw_result | ||
| 291 | ); | ||
| 292 | |||
| 293 | $expected_result = new CS_REST_Wrapper_Result($deserialised, $response_code); | ||
| 294 | |||
| 295 | $this->setup_transport_and_serialisation($transport_result, $call_options, | ||
| 296 | $deserialised, $raw_result, NULL, NULL, $response_code); | ||
| 297 | |||
| 298 | $result = $this->wrapper->get_active_subscribers($since, null, null, null, null, true); | ||
| 299 | |||
| 300 | $this->assertIdentical($expected_result, $result); | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 279 | function testget_unconfirmed_subscribers() { | 304 | function testget_unconfirmed_subscribers() { |
| 280 | $raw_result = 'some subscribers'; | 305 | $raw_result = 'some subscribers'; |
| 281 | $since = '2020'; | 306 | $since = '2020'; | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); |
| ... | @@ -120,7 +120,9 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase { | ... | @@ -120,7 +120,9 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase { |
| 120 | $segment_id = 'abc123'; | 120 | $segment_id = 'abc123'; |
| 121 | $response_code = 200; | 121 | $response_code = 200; |
| 122 | $deserialised = array('Subscriber 1', 'Subscriber 2'); | 122 | $deserialised = array('Subscriber 1', 'Subscriber 2'); |
| 123 | $call_options = $this->get_call_options($this->segment_base_route.'/active.json?date='); | 123 | $tracking_pref = 'false'; |
| 124 | |||
| 125 | $call_options = $this->get_call_options($this->segment_base_route.'/active.json?date=&includeTrackingPreference='.$tracking_pref); | ||
| 124 | 126 | ||
| 125 | $transport_result = array ( | 127 | $transport_result = array ( |
| 126 | 'code' => $response_code, | 128 | 'code' => $response_code, |
| ... | @@ -132,7 +134,7 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase { | ... | @@ -132,7 +134,7 @@ abstract class CS_REST_TestSegments extends CS_REST_TestBase { |
| 132 | $this->setup_transport_and_serialisation($transport_result, $call_options, | 134 | $this->setup_transport_and_serialisation($transport_result, $call_options, |
| 133 | $deserialised, $raw_result, NULL, NULL, $response_code); | 135 | $deserialised, $raw_result, NULL, NULL, $response_code); |
| 134 | 136 | ||
| 135 | $result = $this->wrapper->get_subscribers(); | 137 | $result = $this->wrapper->get_subscribers(null, null, null, null, null, false); |
| 136 | 138 | ||
| 137 | $this->assertIdentical($expected_result, $result); | 139 | $this->assertIdentical($expected_result, $result); |
| 138 | } | 140 | } | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); |
| ... | @@ -30,18 +30,21 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { | ... | @@ -30,18 +30,21 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { |
| 30 | function testadd() { | 30 | function testadd() { |
| 31 | $raw_result = ''; | 31 | $raw_result = ''; |
| 32 | 32 | ||
| 33 | |||
| 33 | $call_options = $this->get_call_options($this->list_base_route.'.json', 'POST'); | 34 | $call_options = $this->get_call_options($this->list_base_route.'.json', 'POST'); |
| 34 | 35 | ||
| 35 | $subscriber = array ( | 36 | $subscriber = array ( |
| 36 | 'Email' => 'test@test.com', | 37 | 'Email' => 'test@test.com', |
| 37 | 'Name' => 'Widget Man!', | 38 | 'Name' => 'Widget Man!', |
| 38 | 'CustomFields' => array(array(1,2), array(3,4)) | 39 | 'CustomFields' => array(array(1,2), array(3,4)), |
| 40 | 'ConsentToTrack' => 'yes' | ||
| 39 | ); | 41 | ); |
| 40 | 42 | ||
| 41 | $this->general_test_with_argument('add', $subscriber, $call_options, | 43 | $this->general_test_with_argument('add', $subscriber, $call_options, |
| 42 | $raw_result, $raw_result, 'subscriber was serialised to this'); | 44 | $raw_result, $raw_result, 'subscriber was serialised to this'); |
| 43 | } | 45 | } |
| 44 | 46 | ||
| 47 | |||
| 45 | function testupdate() { | 48 | function testupdate() { |
| 46 | $raw_result = ''; | 49 | $raw_result = ''; |
| 47 | $email = 'test@test.com'; | 50 | $email = 'test@test.com'; |
| ... | @@ -53,7 +56,8 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { | ... | @@ -53,7 +56,8 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { |
| 53 | $subscriber = array ( | 56 | $subscriber = array ( |
| 54 | 'Email' => 'test2@test.com', | 57 | 'Email' => 'test2@test.com', |
| 55 | 'Name' => 'Widget Man!', | 58 | 'Name' => 'Widget Man!', |
| 56 | 'CustomFields' => array(array(1,2), array(3,4)) | 59 | 'CustomFields' => array(array(1,2), array(3,4)), |
| 60 | 'ConsentToTrack' => 'unchanged', | ||
| 57 | ); | 61 | ); |
| 58 | 62 | ||
| 59 | $transport_result = array ( | 63 | $transport_result = array ( |
| ... | @@ -86,12 +90,14 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { | ... | @@ -86,12 +90,14 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { |
| 86 | array ( | 90 | array ( |
| 87 | 'Email' => 'test@test.com', | 91 | 'Email' => 'test@test.com', |
| 88 | 'Name' => 'Widget Man!', | 92 | 'Name' => 'Widget Man!', |
| 89 | 'CustomFields' => array(array(1,2), array(3,4)) | 93 | 'CustomFields' => array(array(1,2), array(3,4)), |
| 94 | 'ConsentToTrack' => 'no', | ||
| 90 | ), | 95 | ), |
| 91 | array ( | 96 | array ( |
| 92 | 'Email' => 'test@test.com', | 97 | 'Email' => 'test@test.com', |
| 93 | 'Name' => 'Widget Man!', | 98 | 'Name' => 'Widget Man!', |
| 94 | 'CustomFields' => array(array(1,2), array(3,4)) | 99 | 'CustomFields' => array(array(1,2), array(3,4)), |
| 100 | 'ConsentToTrack' => 'yes', | ||
| 95 | ) | 101 | ) |
| 96 | ); | 102 | ); |
| 97 | 103 | ||
| ... | @@ -124,9 +130,10 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { | ... | @@ -124,9 +130,10 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { |
| 124 | $deserialised = array(1,2,34,5); | 130 | $deserialised = array(1,2,34,5); |
| 125 | $response_code = 200; | 131 | $response_code = 200; |
| 126 | $email = 'test@test.com'; | 132 | $email = 'test@test.com'; |
| 133 | $tracking_pref = 'true'; | ||
| 127 | 134 | ||
| 128 | $call_options = $this->get_call_options( | 135 | $call_options = $this->get_call_options( |
| 129 | $this->list_base_route.'.json?email='.urlencode($email), 'GET'); | 136 | $this->list_base_route.'.json?email='.urlencode($email).'&includeTrackingPreference='.$tracking_pref, 'GET'); |
| 130 | 137 | ||
| 131 | $transport_result = array ( | 138 | $transport_result = array ( |
| 132 | 'code' => $response_code, | 139 | 'code' => $response_code, |
| ... | @@ -138,7 +145,7 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { | ... | @@ -138,7 +145,7 @@ abstract class CS_REST_TestSubscribers extends CS_REST_TestBase { |
| 138 | $this->setup_transport_and_serialisation($transport_result, $call_options, | 145 | $this->setup_transport_and_serialisation($transport_result, $call_options, |
| 139 | $deserialised, $raw_result, NULL, NULL, $response_code); | 146 | $deserialised, $raw_result, NULL, NULL, $response_code); |
| 140 | 147 | ||
| 141 | $result = $this->wrapper->get($email); | 148 | $result = $this->wrapper->get($email, true); |
| 142 | 149 | ||
| 143 | $this->assertIdentical($expected_result, $result); | 150 | $this->assertIdentical($expected_result, $result); |
| 144 | } | 151 | } | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | ... | ... |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | require_once __DIR__.'/../vendor/autoload.php'; | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
| 4 | require_once __DIR__.'/../vendor/lastcraft/simpletest/autorun.php'; | 4 | require_once __DIR__.'/../vendor/simpletest/simpletest/autorun.php'; |
| 5 | 5 | ||
| 6 | @Mock::generate('CS_REST_Log'); | 6 | @Mock::generate('CS_REST_Log'); |
| 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); | 7 | @Mock::generate('CS_REST_NativeJsonSerialiser'); |
| ... | @@ -31,20 +31,21 @@ class CS_REST_TestBase extends UnitTestCase { | ... | @@ -31,20 +31,21 @@ class CS_REST_TestBase extends UnitTestCase { |
| 31 | $this->mock_transport->setReturnValue('get_type', $this->transport_type); | 31 | $this->mock_transport->setReturnValue('get_type', $this->transport_type); |
| 32 | $this->mock_serialiser->setReturnValue('get_type', $this->serialisation_type); | 32 | $this->mock_serialiser->setReturnValue('get_type', $this->serialisation_type); |
| 33 | 33 | ||
| 34 | $this->base_route = $this->protocol.'://'.$this->api_host.'/api/v3.1/'; | 34 | $this->base_route = $this->protocol.'://'.$this->api_host.'/api/v3.2/'; |
| 35 | 35 | ||
| 36 | $this->set_up_inner(); | 36 | $this->set_up_inner(); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | function set_up_inner() { | 39 | function set_up_inner() { |
| 40 | $this->wrapper = new CS_REST_General($this->auth, $this->protocol, $this->log_level, | 40 | $this->wrapper = new CS_REST_General($this->auth, $this->protocol, $this->log_level, |
| 41 | $this->api_host, $this->mock_log, $this->mock_serialiser, $this->mock_transport); | 41 | $this->api_host, $this->mock_log, $this->mock_serialiser, |
| 42 | $this->mock_transport); | ||
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | function get_call_options($route, $method = 'GET') { | 45 | function get_call_options($route, $method = 'GET') { |
| 45 | return array ( | 46 | return array ( |
| 46 | 'authdetails' => $this->auth, | 47 | 'authdetails' => $this->auth, |
| 47 | 'userAgent' => 'CS_REST_Wrapper v'.CS_REST_WRAPPER_VERSION. | 48 | 'userAgent' => 'createsend-php v'.CS_REST_WRAPPER_VERSION. |
| 48 | ' PHPv'.phpversion().' over '.$this->transport_type.' with '.$this->serialisation_type, | 49 | ' PHPv'.phpversion().' over '.$this->transport_type.' with '.$this->serialisation_type, |
| 49 | 'contentType' => 'application/json; charset=utf-8', | 50 | 'contentType' => 'application/json; charset=utf-8', |
| 50 | 'deserialise' => true, | 51 | 'deserialise' => true, | ... | ... |
| 1 | { | ||
| 2 | "JourneyID": "183e5a8818d6202e95f1fa747b924226", | ||
| 3 | "Name": "welcome active folks", | ||
| 4 | "TriggerType": "Enters Segment", | ||
| 5 | "Status": "Active", | ||
| 6 | "Emails": [ | ||
| 7 | { | ||
| 8 | "EmailID": "383ec87ea1129ebc5e539a2db35c3200", | ||
| 9 | "Name": "email", | ||
| 10 | "Bounced": 0, | ||
| 11 | "Clicked": 0, | ||
| 12 | "Opened": 1, | ||
| 13 | "Sent": 14, | ||
| 14 | "UniqueOpened": 1, | ||
| 15 | "Unsubscribed": 0 | ||
| 16 | } | ||
| 17 | ] | ||
| 18 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | [ | ||
| 2 | { | ||
| 3 | "ListID": "abcabcabcacbabcabcabcabcabc", | ||
| 4 | "JourneyID": "12345678901234567890", | ||
| 5 | "Name": "Journey One", | ||
| 6 | "Status": "Active" | ||
| 7 | }, | ||
| 8 | { | ||
| 9 | "ListID": "defdefdedefdefdefdefdefdefdef", | ||
| 10 | "JourneyID": "09876543210987654321", | ||
| 11 | "Name": "Journey Two", | ||
| 12 | "Status": "Active" | ||
| 13 | } | ||
| 14 | ] | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
| 1 | 1 | ||
| 2 | Copyright (c) 2016 Nils Adermann, Jordi Boggiano | 2 | Copyright (c) Nils Adermann, Jordi Boggiano |
| 3 | 3 | ||
| 4 | Permission is hereby granted, free of charge, to any person obtaining a copy | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | of this software and associated documentation files (the "Software"), to deal | 5 | of this software and associated documentation files (the "Software"), to deal | ... | ... |
| ... | @@ -2,14 +2,17 @@ | ... | @@ -2,14 +2,17 @@ |
| 2 | 2 | ||
| 3 | // autoload_classmap.php @generated by Composer | 3 | // autoload_classmap.php @generated by Composer |
| 4 | 4 | ||
| 5 | $vendorDir = dirname(dirname(__FILE__)); | 5 | $vendorDir = dirname(__DIR__); |
| 6 | $baseDir = dirname($vendorDir); | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | ||
| 8 | return array( | 8 | return array( |
| 9 | 'CS_REST_Administrators' => $vendorDir . '/campaignmonitor/createsend-php/csrest_administrators.php', | 9 | 'CS_REST_Administrators' => $vendorDir . '/campaignmonitor/createsend-php/csrest_administrators.php', |
| 10 | 'CS_REST_Campaigns' => $vendorDir . '/campaignmonitor/createsend-php/csrest_campaigns.php', | 10 | 'CS_REST_Campaigns' => $vendorDir . '/campaignmonitor/createsend-php/csrest_campaigns.php', |
| 11 | 'CS_REST_Clients' => $vendorDir . '/campaignmonitor/createsend-php/csrest_clients.php', | 11 | 'CS_REST_Clients' => $vendorDir . '/campaignmonitor/createsend-php/csrest_clients.php', |
| 12 | 'CS_REST_Events' => $vendorDir . '/campaignmonitor/createsend-php/csrest_events.php', | ||
| 12 | 'CS_REST_General' => $vendorDir . '/campaignmonitor/createsend-php/csrest_general.php', | 13 | 'CS_REST_General' => $vendorDir . '/campaignmonitor/createsend-php/csrest_general.php', |
| 14 | 'CS_REST_JourneyEmails' => $vendorDir . '/campaignmonitor/createsend-php/csrest_journey_emails.php', | ||
| 15 | 'CS_REST_Journeys' => $vendorDir . '/campaignmonitor/createsend-php/csrest_journeys.php', | ||
| 13 | 'CS_REST_Lists' => $vendorDir . '/campaignmonitor/createsend-php/csrest_lists.php', | 16 | 'CS_REST_Lists' => $vendorDir . '/campaignmonitor/createsend-php/csrest_lists.php', |
| 14 | 'CS_REST_People' => $vendorDir . '/campaignmonitor/createsend-php/csrest_people.php', | 17 | 'CS_REST_People' => $vendorDir . '/campaignmonitor/createsend-php/csrest_people.php', |
| 15 | 'CS_REST_Segments' => $vendorDir . '/campaignmonitor/createsend-php/csrest_segments.php', | 18 | 'CS_REST_Segments' => $vendorDir . '/campaignmonitor/createsend-php/csrest_segments.php', |
| ... | @@ -18,4 +21,5 @@ return array( | ... | @@ -18,4 +21,5 @@ return array( |
| 18 | 'CS_REST_Transactional_ClassicEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php', | 21 | 'CS_REST_Transactional_ClassicEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php', |
| 19 | 'CS_REST_Transactional_SmartEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php', | 22 | 'CS_REST_Transactional_SmartEmail' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php', |
| 20 | 'CS_REST_Transactional_Timeline' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php', | 23 | 'CS_REST_Transactional_Timeline' => $vendorDir . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php', |
| 24 | 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', | ||
| 21 | ); | 25 | ); | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | ||
| 3 | // autoload_namespaces.php @generated by Composer | 3 | // autoload_namespaces.php @generated by Composer |
| 4 | 4 | ||
| 5 | $vendorDir = dirname(dirname(__FILE__)); | 5 | $vendorDir = dirname(__DIR__); |
| 6 | $baseDir = dirname($vendorDir); | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | ||
| 8 | return array( | 8 | return array( | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | ||
| 3 | // autoload_psr4.php @generated by Composer | 3 | // autoload_psr4.php @generated by Composer |
| 4 | 4 | ||
| 5 | $vendorDir = dirname(dirname(__FILE__)); | 5 | $vendorDir = dirname(__DIR__); |
| 6 | $baseDir = dirname($vendorDir); | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | ||
| 8 | return array( | 8 | return array( | ... | ... |
| ... | @@ -13,37 +13,23 @@ class ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d | ... | @@ -13,37 +13,23 @@ class ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d |
| 13 | } | 13 | } |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | /** | ||
| 17 | * @return \Composer\Autoload\ClassLoader | ||
| 18 | */ | ||
| 16 | public static function getLoader() | 19 | public static function getLoader() |
| 17 | { | 20 | { |
| 18 | if (null !== self::$loader) { | 21 | if (null !== self::$loader) { |
| 19 | return self::$loader; | 22 | return self::$loader; |
| 20 | } | 23 | } |
| 21 | 24 | ||
| 25 | require __DIR__ . '/platform_check.php'; | ||
| 26 | |||
| 22 | spl_autoload_register(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader'), true, true); | 27 | spl_autoload_register(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader'), true, true); |
| 23 | self::$loader = $loader = new \Composer\Autoload\ClassLoader(); | 28 | self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
| 24 | spl_autoload_unregister(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader')); | 29 | spl_autoload_unregister(array('ComposerAutoloaderInite6414526548bbe1d789ba4acd123ef7d', 'loadClassLoader')); |
| 25 | 30 | ||
| 26 | $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); | 31 | require __DIR__ . '/autoload_static.php'; |
| 27 | if ($useStaticLoader) { | 32 | call_user_func(\Composer\Autoload\ComposerStaticInite6414526548bbe1d789ba4acd123ef7d::getInitializer($loader)); |
| 28 | require_once __DIR__ . '/autoload_static.php'; | ||
| 29 | |||
| 30 | call_user_func(\Composer\Autoload\ComposerStaticInite6414526548bbe1d789ba4acd123ef7d::getInitializer($loader)); | ||
| 31 | } else { | ||
| 32 | $map = require __DIR__ . '/autoload_namespaces.php'; | ||
| 33 | foreach ($map as $namespace => $path) { | ||
| 34 | $loader->set($namespace, $path); | ||
| 35 | } | ||
| 36 | |||
| 37 | $map = require __DIR__ . '/autoload_psr4.php'; | ||
| 38 | foreach ($map as $namespace => $path) { | ||
| 39 | $loader->setPsr4($namespace, $path); | ||
| 40 | } | ||
| 41 | |||
| 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; | ||
| 43 | if ($classMap) { | ||
| 44 | $loader->addClassMap($classMap); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | 33 | ||
| 48 | $loader->register(true); | 34 | $loader->register(true); |
| 49 | 35 | ... | ... |
| ... | @@ -10,7 +10,10 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d | ... | @@ -10,7 +10,10 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d |
| 10 | 'CS_REST_Administrators' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_administrators.php', | 10 | 'CS_REST_Administrators' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_administrators.php', |
| 11 | 'CS_REST_Campaigns' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_campaigns.php', | 11 | 'CS_REST_Campaigns' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_campaigns.php', |
| 12 | 'CS_REST_Clients' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_clients.php', | 12 | 'CS_REST_Clients' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_clients.php', |
| 13 | 'CS_REST_Events' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_events.php', | ||
| 13 | 'CS_REST_General' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_general.php', | 14 | 'CS_REST_General' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_general.php', |
| 15 | 'CS_REST_JourneyEmails' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_journey_emails.php', | ||
| 16 | 'CS_REST_Journeys' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_journeys.php', | ||
| 14 | 'CS_REST_Lists' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_lists.php', | 17 | 'CS_REST_Lists' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_lists.php', |
| 15 | 'CS_REST_People' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_people.php', | 18 | 'CS_REST_People' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_people.php', |
| 16 | 'CS_REST_Segments' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_segments.php', | 19 | 'CS_REST_Segments' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_segments.php', |
| ... | @@ -19,6 +22,7 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d | ... | @@ -19,6 +22,7 @@ class ComposerStaticInite6414526548bbe1d789ba4acd123ef7d |
| 19 | 'CS_REST_Transactional_ClassicEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php', | 22 | 'CS_REST_Transactional_ClassicEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_classicemail.php', |
| 20 | 'CS_REST_Transactional_SmartEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php', | 23 | 'CS_REST_Transactional_SmartEmail' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_smartemail.php', |
| 21 | 'CS_REST_Transactional_Timeline' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php', | 24 | 'CS_REST_Transactional_Timeline' => __DIR__ . '/..' . '/campaignmonitor/createsend-php/csrest_transactional_timeline.php', |
| 25 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', | ||
| 22 | ); | 26 | ); |
| 23 | 27 | ||
| 24 | public static function getInitializer(ClassLoader $loader) | 28 | public static function getInitializer(ClassLoader $loader) | ... | ... |
| 1 | [ | 1 | { |
| 2 | { | 2 | "packages": [ |
| 3 | "name": "campaignmonitor/createsend-php", | 3 | { |
| 4 | "version": "v5.0.2", | 4 | "name": "campaignmonitor/createsend-php", |
| 5 | "version_normalized": "5.0.2.0", | 5 | "version": "v6.1.2", |
| 6 | "source": { | 6 | "version_normalized": "6.1.2.0", |
| 7 | "type": "git", | 7 | "source": { |
| 8 | "url": "https://github.com/campaignmonitor/createsend-php.git", | 8 | "type": "git", |
| 9 | "reference": "05407e838eda316709d55011ad7328a679296988" | 9 | "url": "https://github.com/campaignmonitor/createsend-php.git", |
| 10 | }, | 10 | "reference": "922cec7fbc9da1508c18156db7693a6ddad7194e" |
| 11 | "dist": { | 11 | }, |
| 12 | "type": "zip", | 12 | "dist": { |
| 13 | "url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/05407e838eda316709d55011ad7328a679296988", | 13 | "type": "zip", |
| 14 | "reference": "05407e838eda316709d55011ad7328a679296988", | 14 | "url": "https://api.github.com/repos/campaignmonitor/createsend-php/zipball/922cec7fbc9da1508c18156db7693a6ddad7194e", |
| 15 | "shasum": "" | 15 | "reference": "922cec7fbc9da1508c18156db7693a6ddad7194e", |
| 16 | }, | 16 | "shasum": "" |
| 17 | "require": { | 17 | }, |
| 18 | "php": ">=5.3.0" | 18 | "require": { |
| 19 | }, | 19 | "php": ">=5.3.0" |
| 20 | "require-dev": { | 20 | }, |
| 21 | "lastcraft/simpletest": "~1.1" | 21 | "require-dev": { |
| 22 | }, | 22 | "simpletest/simpletest": "~1.1.3" |
| 23 | "time": "2016-07-19 18:49:32", | 23 | }, |
| 24 | "type": "library", | 24 | "time": "2021-10-02T04:57:43+00:00", |
| 25 | "installation-source": "dist", | 25 | "type": "library", |
| 26 | "autoload": { | 26 | "installation-source": "dist", |
| 27 | "classmap": [ | 27 | "autoload": { |
| 28 | "csrest_administrators.php", | 28 | "classmap": [ |
| 29 | "csrest_campaigns.php", | 29 | "csrest_administrators.php", |
| 30 | "csrest_clients.php", | 30 | "csrest_campaigns.php", |
| 31 | "csrest_general.php", | 31 | "csrest_clients.php", |
| 32 | "csrest_lists.php", | 32 | "csrest_general.php", |
| 33 | "csrest_people.php", | 33 | "csrest_events.php", |
| 34 | "csrest_segments.php", | 34 | "csrest_lists.php", |
| 35 | "csrest_subscribers.php", | 35 | "csrest_people.php", |
| 36 | "csrest_templates.php", | 36 | "csrest_segments.php", |
| 37 | "csrest_transactional_classicemail.php", | 37 | "csrest_subscribers.php", |
| 38 | "csrest_transactional_smartemail.php", | 38 | "csrest_templates.php", |
| 39 | "csrest_transactional_timeline.php" | 39 | "csrest_transactional_classicemail.php", |
| 40 | ] | 40 | "csrest_transactional_smartemail.php", |
| 41 | }, | 41 | "csrest_transactional_timeline.php", |
| 42 | "notification-url": "https://packagist.org/downloads/", | 42 | "csrest_journeys.php", |
| 43 | "license": [ | 43 | "csrest_journey_emails.php" |
| 44 | "MIT" | 44 | ] |
| 45 | ], | 45 | }, |
| 46 | "authors": [ | 46 | "notification-url": "https://packagist.org/downloads/", |
| 47 | { | 47 | "license": [ |
| 48 | "name": "Toby Brain", | 48 | "MIT" |
| 49 | "email": "tobio85@gmail.com", | 49 | ], |
| 50 | "role": "Developer" | 50 | "authors": [ |
| 51 | } | 51 | { |
| 52 | ], | 52 | "name": "Toby Brain", |
| 53 | "description": "A php library which implements the complete functionality of the Campaign Monitor API.", | 53 | "email": "tobio85@gmail.com", |
| 54 | "homepage": "http://campaignmonitor.github.io/createsend-php/", | 54 | "role": "Developer" |
| 55 | "keywords": [ | 55 | } |
| 56 | "api", | 56 | ], |
| 57 | "campaign", | 57 | "description": "A php library which implements the complete functionality of the Campaign Monitor API.", |
| 58 | "monitor" | 58 | "homepage": "http://campaignmonitor.github.io/createsend-php/", |
| 59 | ] | 59 | "keywords": [ |
| 60 | } | 60 | "api", |
| 61 | ] | 61 | "campaign", |
| 62 | "monitor" | ||
| 63 | ], | ||
| 64 | "support": { | ||
| 65 | "issues": "https://github.com/campaignmonitor/createsend-php/issues", | ||
| 66 | "source": "https://github.com/campaignmonitor/createsend-php/tree/v6.1.2" | ||
| 67 | }, | ||
| 68 | "install-path": "../campaignmonitor/createsend-php" | ||
| 69 | } | ||
| 70 | ], | ||
| 71 | "dev": true, | ||
| 72 | "dev-package-names": [] | ||
| 73 | } | ... | ... |
| 1 | <?php return array( | ||
| 2 | 'root' => array( | ||
| 3 | 'name' => '__root__', | ||
| 4 | 'pretty_version' => 'dev-master', | ||
| 5 | 'version' => 'dev-master', | ||
| 6 | 'reference' => '734b44a846bc2036531a17291e42e1b8dc4a3266', | ||
| 7 | 'type' => 'library', | ||
| 8 | 'install_path' => __DIR__ . '/../../', | ||
| 9 | 'aliases' => array(), | ||
| 10 | 'dev' => true, | ||
| 11 | ), | ||
| 12 | 'versions' => array( | ||
| 13 | '__root__' => array( | ||
| 14 | 'pretty_version' => 'dev-master', | ||
| 15 | 'version' => 'dev-master', | ||
| 16 | 'reference' => '734b44a846bc2036531a17291e42e1b8dc4a3266', | ||
| 17 | 'type' => 'library', | ||
| 18 | 'install_path' => __DIR__ . '/../../', | ||
| 19 | 'aliases' => array(), | ||
| 20 | 'dev_requirement' => false, | ||
| 21 | ), | ||
| 22 | 'campaignmonitor/createsend-php' => array( | ||
| 23 | 'pretty_version' => 'v6.1.2', | ||
| 24 | 'version' => '6.1.2.0', | ||
| 25 | 'reference' => '922cec7fbc9da1508c18156db7693a6ddad7194e', | ||
| 26 | 'type' => 'library', | ||
| 27 | 'install_path' => __DIR__ . '/../campaignmonitor/createsend-php', | ||
| 28 | 'aliases' => array(), | ||
| 29 | 'dev_requirement' => false, | ||
| 30 | ), | ||
| 31 | ), | ||
| 32 | ); |
| 1 | <?php | ||
| 2 | |||
| 3 | // platform_check.php @generated by Composer | ||
| 4 | |||
| 5 | $issues = array(); | ||
| 6 | |||
| 7 | if (!(PHP_VERSION_ID >= 50300)) { | ||
| 8 | $issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.0". You are running ' . PHP_VERSION . '.'; | ||
| 9 | } | ||
| 10 | |||
| 11 | if ($issues) { | ||
| 12 | if (!headers_sent()) { | ||
| 13 | header('HTTP/1.1 500 Internal Server Error'); | ||
| 14 | } | ||
| 15 | if (!ini_get('display_errors')) { | ||
| 16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { | ||
| 17 | fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); | ||
| 18 | } elseif (!headers_sent()) { | ||
| 19 | echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; | ||
| 20 | } | ||
| 21 | } | ||
| 22 | trigger_error( | ||
| 23 | 'Composer detected issues in your platform: ' . implode(' ', $issues), | ||
| 24 | E_USER_ERROR | ||
| 25 | ); | ||
| 26 | } |
-
Please register or sign in to post a comment