summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md24
-rw-r--r--composer.json8
-rw-r--r--composer.lock12
-rw-r--r--examples/transmission/configuration_based.php5
-rw-r--r--examples/transmission/get_all_transmissions.php4
-rw-r--r--examples/transmission/get_transmission.php4
-rw-r--r--examples/transmission/rfc822.php4
-rw-r--r--examples/transmission/send_transmission_all_fields.php10
-rw-r--r--examples/transmission/stored_recipients_inline_content.php4
-rw-r--r--examples/transmission/stored_template_send.php4
-rw-r--r--lib/SparkPost/SparkPost.php (renamed from lib/MessageSystems/SparkPost.php)2
-rw-r--r--lib/SparkPost/Transmission.php (renamed from lib/MessageSystems/Transmission.php)14
-rw-r--r--test/unit/SparkPostTest.php4
-rw-r--r--test/unit/TransmissionTest.php8
14 files changed, 65 insertions, 42 deletions
diff --git a/README.md b/README.md
index 3520ace..bc84762 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,30 @@ try {
* [Transmissions](https://github.com/MessageSystems/php-sdk/tree/master/examples/transmission/)
* Read our REST API documentation - <http://www.sparkpost.com/docs/introduction>
+## Field Descriptions
+### Transmissions
+| Field Name | Required? | Description | Data Type |
+| ------------ | ----------- | ------------- | ----------- |
+| description | no | Field for describing what this transmission is for the user | String |
+| campaign | no | Field for assigning a given transmission to a specific campaign, which is a logical container for similar transmissions | String |
+| metadata | no | Field for adding arbitrary key/value pairs which will be included in open/click tracking | Object (Simple) |
+| substitutionData | no | Field for adding transmission level substitution data, which can be used in a variety of fields and in content | Object (Complex) |
+| trackOpens | no | Field for enabling/disabling transmission level open tracking (default: true) | Boolean |
+| trackClicks | no | Field for enabling/disabling transmission level click tracking (default: true) | Boolean |
+| useDraftTemplate | no | Field for allowing the sending of a transmission using a draft of a stored template (default: false) | Boolean |
+| replyTo | no | Field for specifying the email address that should be used when a recipient hits the reply button | String |
+| subject | yes | Field for setting the subject line of a given transmission | String |
+| from | yes | Field for setting the from line of a given transmission | String or Object |
+| html | yes** | Field for setting the HTML content of a given transmission | String |
+| text | yes** | Field for setting the Plain Text content of a given transmission | String |
+| rfc822 | no** | Field for setting the RFC-822 encoded content of a given transmission | String |
+| template | no** | Field for specifying the Template ID of a stored template to be used when sending a given transmission | String |
+| customHeaders | no | Field for specifying additional headers to be applied to a given transmission (other than Subject, From, To, and Reply-To) | Object (Simple) |
+| recipients | yes** | Field for specifying who a given transmission should be sent to | Array of Objects |
+| recipientList | no** | Field for specifying a stored recipient list ID to be used for a given transmission | String |
+
+** - If using inline content then html or text are required. If using RFC-822 Inline Content, then rfc822 is required. If using a stored recipient list, then recipientList is required. If using a stored template, then template is required.
+
## Tips and Tricks
### General
* You _must_ provide at least an API key when instantiating the SparkPost Library - `[ 'key'=>'184ac5480cfdd2bb2859e4476d2e5b1d2bad079bf' ]`
diff --git a/composer.json b/composer.json
index 5bfd63a..01c658c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,10 +1,10 @@
{
- "name": "messagesystems/php-sdk",
+ "name": "sparkpost/php-sdk",
"description": "SDK for interfacing with messagesystems APIs",
- "license": "Apache",
+ "license": "Apache 2.0",
"authors": [
{
- "name": "Message Systems",
+ "name": "Message Systems, Inc.",
"email": "info@messagesystems.com"
}
],
@@ -19,7 +19,7 @@
},
"autoload": {
"psr-4": {
- "MessageSystems\\": "lib/MessageSystems/"
+ "SparkPost\\": "lib/SparkPost/"
}
}
}
diff --git a/composer.lock b/composer.lock
index a2c948d..c9bd5ff 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "25bb67c57c5a357f0cc9873a717dfd51",
+ "hash": "f50d7f6f0ceb190ba8f8489f4cffeabe",
"packages": [
{
"name": "guzzlehttp/guzzle",
@@ -65,16 +65,16 @@
},
{
"name": "guzzlehttp/ringphp",
- "version": "1.0.2",
+ "version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
- "reference": "86df4c0ea5459b292ff8c519f8db1513ea41ca9b"
+ "reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/86df4c0ea5459b292ff8c519f8db1513ea41ca9b",
- "reference": "86df4c0ea5459b292ff8c519f8db1513ea41ca9b",
+ "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/e7c28f96c5ac12ab0e63412cfc15989756fcb964",
+ "reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964",
"shasum": ""
},
"require": {
@@ -111,7 +111,7 @@
"homepage": "https://github.com/mtdowling"
}
],
- "time": "2014-10-29 02:00:14"
+ "time": "2014-11-04 07:01:14"
},
{
"name": "guzzlehttp/streams",
diff --git a/examples/transmission/configuration_based.php b/examples/transmission/configuration_based.php
index 157d3f3..81d61cf 100644
--- a/examples/transmission/configuration_based.php
+++ b/examples/transmission/configuration_based.php
@@ -2,15 +2,14 @@
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
try {
$results = Transmission::send([
- "returnPath"=>"return@example.com",
"from"=>"From Envelope <from@example.com>",
"html"=>"<p>Hello World!</p>",
"text"=>"Hello World!",
diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php
index 754a6fc..c8c92e5 100644
--- a/examples/transmission/get_all_transmissions.php
+++ b/examples/transmission/get_all_transmissions.php
@@ -2,8 +2,8 @@
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php
index b85d814..9c90b85 100644
--- a/examples/transmission/get_transmission.php
+++ b/examples/transmission/get_transmission.php
@@ -1,8 +1,8 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php
index 1927382..0635e15 100644
--- a/examples/transmission/rfc822.php
+++ b/examples/transmission/rfc822.php
@@ -1,8 +1,8 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php
index 6064e67..da5ddff 100644
--- a/examples/transmission/send_transmission_all_fields.php
+++ b/examples/transmission/send_transmission_all_fields.php
@@ -1,8 +1,8 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
@@ -19,11 +19,11 @@ try{
],
"description"=>"my description",
"replyTo"=>"reply@test.com",
- "headers"=>[
+ "CustomHeaders"=>[
"X-Custom-Header"=>"Sample Custom Header"
],
- "openTracking"=>false,
- "clickTracking"=>false,
+ "trackOpens"=>false,
+ "trackClicks"=>false,
"from"=>"From Envelope <from@example.com>",
"html"=>"<p>Hello World! Your name is: {{name}}</p>",
"text"=>"Hello World!",
diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php
index f09ca63..efd2b13 100644
--- a/examples/transmission/stored_recipients_inline_content.php
+++ b/examples/transmission/stored_recipients_inline_content.php
@@ -1,8 +1,8 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php
index 298ba69..4d8ce49 100644
--- a/examples/transmission/stored_template_send.php
+++ b/examples/transmission/stored_template_send.php
@@ -1,8 +1,8 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
-use MessageSystems\SparkPost;
-use MessageSystems\Transmission;
+use SparkPost\SparkPost;
+use SparkPost\Transmission;
$key = 'YOURAPIKEY';
SparkPost::setConfig(['key'=>$key]);
diff --git a/lib/MessageSystems/SparkPost.php b/lib/SparkPost/SparkPost.php
index b1ad20a..14af3cd 100644
--- a/lib/MessageSystems/SparkPost.php
+++ b/lib/SparkPost/SparkPost.php
@@ -1,5 +1,5 @@
<?php
-namespace MessageSystems;
+namespace SparkPost;
class SparkPost {
diff --git a/lib/MessageSystems/Transmission.php b/lib/SparkPost/Transmission.php
index e820cff..185f64b 100644
--- a/lib/MessageSystems/Transmission.php
+++ b/lib/SparkPost/Transmission.php
@@ -1,5 +1,5 @@
<?php
-namespace MessageSystems;
+namespace SparkPost;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
@@ -29,12 +29,12 @@ class Transmission {
'html'=>'content.html',
'text'=>'content.text',
'rfc822Part'=>'content.email_rfc822',
- 'headers'=>'content.headers',
+ 'customHeaders'=>'content.headers',
'recipients'=>'recipients',
'recipientList'=>'recipients.list_id',
'template'=>'content.template_id',
- 'openTracking'=>'options.open_tracking',
- 'clickTracking'=>'options.click_tracking',
+ 'trackOpens'=>'options.open_tracking',
+ 'trackClicks'=>'options.click_tracking',
'useDraftTemplate'=>'use_draft_template'
];
@@ -114,12 +114,12 @@ class Transmission {
* 'html': string,
* 'text': string,
* 'rfc822Part': string,
- * 'headers': array,
+ * 'customHeaders': array,
* 'recipients': array,
* 'recipientList': string,
* 'template': string,
- * 'openTracking': boolean,
- * 'clickTracking': boolean,
+ * 'trackOpens': boolean,
+ * 'trackClicks': boolean,
* 'useDraftTemplate': boolean
*
* @return array API repsonse represented as key-value pairs
diff --git a/test/unit/SparkPostTest.php b/test/unit/SparkPostTest.php
index 1b86a8f..cc1c9c9 100644
--- a/test/unit/SparkPostTest.php
+++ b/test/unit/SparkPostTest.php
@@ -1,7 +1,7 @@
<?php
namespace SparkPost\Test;
-use MessageSystems\SparkPost;
+use SparkPost\SparkPost;
class SparkPostTest extends \PHPUnit_Framework_TestCase {
@@ -9,7 +9,7 @@ class SparkPostTest extends \PHPUnit_Framework_TestCase {
* @desc Ensures that the configuration class is not instantiable.
*/
public function testConstructorCannotBeCalled() {
- $class = new \ReflectionClass('\MessageSystems\SparkPost');
+ $class = new \ReflectionClass('\SparkPost\SparkPost');
$this->assertFalse($class->isInstantiable());
}
diff --git a/test/unit/TransmissionTest.php b/test/unit/TransmissionTest.php
index ae7d59d..2a0bcfe 100644
--- a/test/unit/TransmissionTest.php
+++ b/test/unit/TransmissionTest.php
@@ -1,8 +1,8 @@
<?php
namespace SparkPost\Test;
-use MessageSystems\Transmission;
-use MessageSystems\SparkPost;
+use SparkPost\Transmission;
+use SparkPost\SparkPost;
use GuzzleHttp\Subscriber\Mock;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Stream\Stream;
@@ -21,7 +21,7 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase {
* @return ReflectionMethod
*/
private static function getMethod($name) {
- $class = new \ReflectionClass('\MessageSystems\Transmission');
+ $class = new \ReflectionClass('\SparkPost\Transmission');
$method = $class->getMethod($name);
$method->setAccessible(true);
return $method;
@@ -41,7 +41,7 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase {
* @desc Ensures that the configuration class is not instantiable.
*/
public function testConstructorCannotBeCalled() {
- $class = new \ReflectionClass('\MessageSystems\Transmission');
+ $class = new \ReflectionClass('\SparkPost\Transmission');
$this->assertFalse($class->isInstantiable());
}