From 5fd553c9471de7d479d3e90723899ff10c5ccdd6 Mon Sep 17 00:00:00 2001 From: Bastor Date: Mon, 29 Jan 2018 16:38:32 +0200 Subject: [PATCH] [#151] Added missing endpoints to new library --- src/Bounce.php | 18 ++++++++++++++++++ src/BounceManager.php | 34 ++++++++++++++++++++++++++++++++++ src/Link.php | 17 +++++++++++++++++ src/LinkManager.php | 34 ++++++++++++++++++++++++++++++++++ src/Open.php | 16 ++++++++++++++++ src/OpenManager.ph | 34 ++++++++++++++++++++++++++++++++++ src/Report.php | 31 +++++++++++++++++++++++++++++++ src/ReportManager.php | 14 ++++++++++++++ src/Unsubscribe.php | 14 ++++++++++++++ src/UnsubscribeManager.php | 34 ++++++++++++++++++++++++++++++++++ 10 files changed, 246 insertions(+) create mode 100644 src/Bounce.php create mode 100644 src/BounceManager.php create mode 100644 src/Link.php create mode 100644 src/LinkManager.php create mode 100644 src/Open.php create mode 100644 src/OpenManager.ph create mode 100644 src/Report.php create mode 100644 src/ReportManager.php create mode 100644 src/Unsubscribe.php create mode 100644 src/UnsubscribeManager.php diff --git a/src/Bounce.php b/src/Bounce.php new file mode 100644 index 0000000..d45541a --- /dev/null +++ b/src/Bounce.php @@ -0,0 +1,18 @@ +basePath, '/') . '/' . rtrim($id, '/') . '/' . 'bounces/?paginate_by=100'; + } + + public function constructEntity($data) + { + $array = []; + foreach ($data->body['results'] as $result) + { + $entity = new $this->entityClass(); + foreach (array_keys(get_object_vars($entity)) as $property) { + if (property_exists($result, $property)) { + $entity->$property = $result->$property; + } + } + array_push($array, $entity); + } + return $array; +} diff --git a/src/Link.php b/src/Link.php new file mode 100644 index 0000000..fc98025 --- /dev/null +++ b/src/Link.php @@ -0,0 +1,17 @@ +basePath, '/') . '/' . rtrim($id, '/') . '/' . 'links/?paginate_by=100'; + } + + public function constructEntity($data) + { + $array = []; + foreach ($data->body['results'] as $result) + { + $entity = new $this->entityClass(); + foreach (array_keys(get_object_vars($entity)) as $property) { + if (property_exists($result, $property)) { + $entity->$property = $result->$property; + } + } + array_push($array, $entity); + } + return $array; +} diff --git a/src/Open.php b/src/Open.php new file mode 100644 index 0000000..1dde90d --- /dev/null +++ b/src/Open.php @@ -0,0 +1,16 @@ +basePath, '/') . '/' . rtrim($id, '/') . '/' . 'opens/?paginate_by=100'; + } + + public function constructEntity($data) + { + $array = []; + foreach ($data->body['results'] as $result) + { + $entity = new $this->entityClass(); + foreach (array_keys(get_object_vars($entity)) as $property) { + if (property_exists($result, $property)) { + $entity->$property = $result->$property; + } + } + array_push($array, $entity); + } + return $array; +} diff --git a/src/Report.php b/src/Report.php new file mode 100644 index 0000000..fe2eaf9 --- /dev/null +++ b/src/Report.php @@ -0,0 +1,31 @@ +basePath, '/') . '/' . rtrim($id, '/') . '/' . 'unsubscribed/?paginate_by=100'; + } + + public function constructEntity($data) + { + $array = []; + foreach ($data->body['results'] as $result) + { + $entity = new $this->entityClass(); + foreach (array_keys(get_object_vars($entity)) as $property) { + if (property_exists($result, $property)) { + $entity->$property = $result->$property; + } + } + array_push($array, $entity); + } + return $array; +}