diff --git a/src/Mailgun/Model/Stats/TotalResponseItem.php b/src/Mailgun/Model/Stats/TotalResponseItem.php index a19db50..07dc5b8 100644 --- a/src/Mailgun/Model/Stats/TotalResponseItem.php +++ b/src/Mailgun/Model/Stats/TotalResponseItem.php @@ -34,6 +34,11 @@ class TotalResponseItem */ private $failed; + /** + * @var array + */ + private $complained; + /** * @param array $data * @@ -45,7 +50,8 @@ class TotalResponseItem isset($data['time']) ? new \DateTime($data['time']) : null, isset($data['accepted']) ? $data['accepted'] : [], isset($data['delivered']) ? $data['delivered'] : [], - isset($data['failed']) ? $data['failed'] : [] + isset($data['failed']) ? $data['failed'] : [], + isset($data['complained']) ? $data['complained'] : [] ); } @@ -54,13 +60,15 @@ class TotalResponseItem * @param array $accepted * @param array $delivered * @param array $failed + * @param array $complained */ - private function __construct(\DateTime $time, array $accepted, array $delivered, array $failed) + private function __construct(\DateTime $time, array $accepted, array $delivered, array $failed, array $complained) { $this->time = $time; $this->accepted = $accepted; $this->delivered = $delivered; $this->failed = $failed; + $this->complained = $complained; } /** @@ -94,4 +102,12 @@ class TotalResponseItem { return $this->failed; } + + /** + * @return array + */ + public function getComplained() + { + return $this->complained; + } } diff --git a/tests/Model/Stats/TotalResponseTest.php b/tests/Model/Stats/TotalResponseTest.php new file mode 100644 index 0000000..052e28b --- /dev/null +++ b/tests/Model/Stats/TotalResponseTest.php @@ -0,0 +1,66 @@ +assertEquals('2012-02-14', $model->getStart()->format('Y-m-d')); + $this->assertCount(1, $model->getStats()); + $stats = $model->getStats(); + $stats = $stats[0]; + $this->assertEquals('2012-02-14', $stats->getTime()->format('Y-m-d')); + $this->assertEquals('1', $stats->getComplained()['total']); + } +}