diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | composer.lock | 10 | ||||
-rw-r--r-- | lib/MessageSystems/Configuration.php | 2 | ||||
-rw-r--r-- | lib/MessageSystems/SendGridCompatibility/Email.php | 84 | ||||
-rw-r--r-- | lib/MessageSystems/SendGridCompatibility/SDK.php | 24 | ||||
-rw-r--r-- | lib/MessageSystems/Transmission.php | 6 | ||||
-rw-r--r-- | lib/SparkPost.php | 14 |
8 files changed, 24 insertions, 122 deletions
@@ -1,5 +1,5 @@ /vendor/ .project .settings -.buildPath +.buildpath test/output/ @@ -75,9 +75,9 @@ try { ## Development ### Setup -We use [Robo](http://robo.li/) for our task runner, please follow the instructions on their website to install Robo. +We use [Robo](http://robo.li/) for our task runner. -Run `composer install` inside the directory to install dependecies and development tools. +Run `composer install` inside the directory to install dependecies and development tools including Robo. ### Testing Once all the dependencies are installed, you can execute the unit tests using `vendor\bin\robo test` diff --git a/composer.lock b/composer.lock index 7b617f6..a2c948d 100644 --- a/composer.lock +++ b/composer.lock @@ -65,16 +65,16 @@ }, { "name": "guzzlehttp/ringphp", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/guzzle/RingPHP.git", - "reference": "bdb67d6da3e2af33dee5c85c971203d4503c8540" + "reference": "86df4c0ea5459b292ff8c519f8db1513ea41ca9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/bdb67d6da3e2af33dee5c85c971203d4503c8540", - "reference": "bdb67d6da3e2af33dee5c85c971203d4503c8540", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/86df4c0ea5459b292ff8c519f8db1513ea41ca9b", + "reference": "86df4c0ea5459b292ff8c519f8db1513ea41ca9b", "shasum": "" }, "require": { @@ -111,7 +111,7 @@ "homepage": "https://github.com/mtdowling" } ], - "time": "2014-10-26 21:10:50" + "time": "2014-10-29 02:00:14" }, { "name": "guzzlehttp/streams", diff --git a/lib/MessageSystems/Configuration.php b/lib/MessageSystems/Configuration.php index 106d1d5..d44cab3 100644 --- a/lib/MessageSystems/Configuration.php +++ b/lib/MessageSystems/Configuration.php @@ -23,7 +23,7 @@ class Configuration { * @param Array $configMap - Hashmap that contains config values for the SDK to connect to SparkPost * @throws \Exception */ - public static function setConfig($configMap) { + public static function setConfig(array $configMap) { //check for API key because its required if (!isset($configMap['key']) || empty(trim($configMap['key']))){ throw new \Exception('You must provide an API key'); diff --git a/lib/MessageSystems/SendGridCompatibility/Email.php b/lib/MessageSystems/SendGridCompatibility/Email.php deleted file mode 100644 index 68c94b7..0000000 --- a/lib/MessageSystems/SendGridCompatibility/Email.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -namespace MessageSystems\SendGridCompatibility; - -use MessageSystems\Transmission; - -class Email { - private $transmission; - - public function __construct() { - $this->transmission = new Transmission(); - } - - public function send() { - $this->transmission->send(); - } - - public function addTo($address) { - $this->transmission->addRecipient($address); - return $this; - } - - public function setTos(Array $addresses) { - $this->transmission->addRecipients($addresses); - return $this; - } - - /** - * - * @param string $address - * @return \MessageSystems\SendGridCompatibility\Email - */ - public function setFrom($address) { - $this->transmission->setFrom($address); - return $this; - } - - /** - * TODO:figure this out - * @param string $name - */ - public function setFromName($name) { - - return $this; - } - - - /** - * - * @param string $address - * @return \MessageSystems\SendGridCompatibility\Email - */ - public function setReplyTo($address) { - $this->transmission->setReplyTo($address); - return $this; - } - - /** - * TODO: Does this work? - * - * - * @param string $address - * @return \MessageSystems\SendGridCompatibility\Email - */ - public function addBcc($address) { - $this->transmission->addRecipient($address); - return $this; - } - - public function setSubject($subject) { - $this->transmission->setSubject($subject); - return $this; - } - - public function setText($text) { - $this->transmission->setTextContent($text); - return $this; - } - - public function setHtml($html) { - $this->transmission->setHTMLContent($html); - return $this; - } -} -?>
\ No newline at end of file diff --git a/lib/MessageSystems/SendGridCompatibility/SDK.php b/lib/MessageSystems/SendGridCompatibility/SDK.php deleted file mode 100644 index f1a4df3..0000000 --- a/lib/MessageSystems/SendGridCompatibility/SDK.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -namespace MessageSystems\SendGridCompatibility; - -use MessageSystems\Transmission; -use MessageSystems\SendGridCompatibility\Email; -use MessageSystems\Configuration; - -class SDK{ - private $sparkPost; - - public function __construct($username, $password, $options = null) { - //username isn't used in our system - $opts = ['key'=>$password]; - if (!is_null($options)) { - $opts = array_merge($opts, $options); - } - Configuration::setConfig($opts); - } - - public function send(Email $email) { - $email->send(); - } -} -?>
\ No newline at end of file diff --git a/lib/MessageSystems/Transmission.php b/lib/MessageSystems/Transmission.php index 294ec01..2b4b9cc 100644 --- a/lib/MessageSystems/Transmission.php +++ b/lib/MessageSystems/Transmission.php @@ -420,7 +420,7 @@ class Transmission { * @param array $headers Key-value pairs of headers to add to the content of a Transmission * @return \MessageSystems\Transmission Object */ - public function setContentHeaders (Array $headers) { + public function setContentHeaders (array $headers) { $this->model['content']['headers'] = $headers; return $this; } @@ -439,7 +439,7 @@ class Transmission { * @param array $recipient An associative array of recipient data to send a Transmission * @return \MessageSystems\Transmission Object */ - public function addRecipient (Array $recipient) { + public function addRecipient (array $recipient) { if(!is_array($this->model['recipients'])) { $this->model['recipients'] = []; } @@ -460,7 +460,7 @@ class Transmission { * @param array $recipients An array of associative arrays containing recipient data * @return \MessageSystems\Transmission Object */ - public function addRecipients (Array $recipients) { + public function addRecipients (array $recipients) { if(!is_array($this->model['recipients'])) { $this->model['recipients'] = []; } diff --git a/lib/SparkPost.php b/lib/SparkPost.php index 2a4b589..539b0db 100644 --- a/lib/SparkPost.php +++ b/lib/SparkPost.php @@ -8,11 +8,21 @@ class SparkPost { public $transmission; - public function __construct($globalOpts) { + /** + * @desc Sets up the config for the sdk suite + * @param array $globalOpts + */ + public function __construct(array $globalOpts) { Configuration::setConfig($globalOpts); } - public function Transmission(Array $options = null) { + /** + * @desc Creates a new Transmission object and returns it. + * @param array $options Transmission constructor options + * @see \MessageSystems\Transmission + * @return \MessageSystems\Transmission + */ + public function Transmission(array $options = null) { $this->transmission = new Transmission($options); return $this->transmission; } |