summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeardyman <nornholdj@gmail.com>2016-02-23 00:31:15 -0500
committerbeardyman <nornholdj@gmail.com>2016-02-23 00:31:15 -0500
commit267b9c7c3c856fc081450cc8f796dd38ce664f39 (patch)
tree0b681600d3ebacaec5f8aac5410bec4e8eb7dce5
parent547f84d69ab1ca529b112aab43aa6f5b901aaa25 (diff)
downloadphp-sparkpost-267b9c7c3c856fc081450cc8f796dd38ce664f39.zip
php-sparkpost-267b9c7c3c856fc081450cc8f796dd38ce664f39.tar.gz
php-sparkpost-267b9c7c3c856fc081450cc8f796dd38ce664f39.tar.bz2
added new exception type and unwrapped example for webhooks
-rw-r--r--examples/unwrapped/get_webhooks.php25
-rw-r--r--lib/SparkPost/APIResponseException.php9
2 files changed, 34 insertions, 0 deletions
diff --git a/examples/unwrapped/get_webhooks.php b/examples/unwrapped/get_webhooks.php
new file mode 100644
index 0000000..b9ed723
--- /dev/null
+++ b/examples/unwrapped/get_webhooks.php
@@ -0,0 +1,25 @@
+<?php
+namespace Examples\Unwrapped;
+require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . '/../example-config.json');
+$config = json_decode($configFile, true);
+
+use SparkPost\SparkPost;
+use GuzzleHttp\Client;
+use Ivory\HttpAdapter\Guzzle6HttpAdapter;
+
+$httpAdapter = new Guzzle6HttpAdapter(new Client());
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
+
+try {
+ $sparky->setupUnwrapped('webhooks');
+
+ $results = $sparky->webhooks->get();
+
+ echo 'Congrats you can use your SDK!';
+} catch (\Exception $exception) {
+ echo $exception->getMessage();
+}
+?>
diff --git a/lib/SparkPost/APIResponseException.php b/lib/SparkPost/APIResponseException.php
new file mode 100644
index 0000000..cc0842c
--- /dev/null
+++ b/lib/SparkPost/APIResponseException.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace SparkPost;
+
+class APIResponseException extends \Exception {
+
+}
+
+?>