Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Bounce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Gan;

/**
* Represents a bounce object.
*/
class Bounce extends Entity
{
public $url;
public $status;
public $contact;
public $contact_url;
public $contact_active;
public $description;
public $created;
public $error_type;
}
34 changes: 34 additions & 0 deletions src/BounceManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Gan;

/**
* Entity manager for the Bounce entity.
*/
class BounceManager extends EntityManager
{
protected $basePath = 'reports';
protected $entityClass = '\Gan\Bounce';
protected $writableFields = [];
protected $lookupField = 'report_id';

protected function getPath($id)
{
return rtrim($this->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;
}
17 changes: 17 additions & 0 deletions src/Link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Gan;

/**
* Represents a link object.
*/
class Link extends Entity
{
public $id;
public $url;
public $link;
public $unique_clicks;
public $clicks_url;
public $total_clicks;
public $percent_of_total;
}
34 changes: 34 additions & 0 deletions src/LinkManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Gan;

/**
* Entity manager for the Link entity.
*/
class LinkManager extends EntityManager
{
protected $basePath = 'reports';
protected $entityClass = '\Gan\Link';
protected $writableFields = [];
protected $lookupField = 'report_id';

protected function getPath($id)
{
return rtrim($this->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;
}
16 changes: 16 additions & 0 deletions src/Open.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Gan;

/**
* Represents an open object.
*/
class Open extends Entity
{
public $url;
public $contact;
public $contact_url;
public $first_view;
public $last_view;
public $count;
}
34 changes: 34 additions & 0 deletions src/OpenManager.ph
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Gan;

/**
* Entity manager for the Open entity.
*/
class OpenManager extends EntityManager
{
protected $basePath = 'reports';
protected $entityClass = '\Gan\Open';
protected $writableFields = [];
protected $lookupField = 'report_id';

protected function getPath($id)
{
return rtrim($this->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;
}
31 changes: 31 additions & 0 deletions src/Report.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Gan;

/**
* Represents a report object.
*/
class Report extends Entity
{
public $links_url;
public $bounced_temporary;
public $bounced_permanent;
public $sender_email;
public $unsubscribed_url;
public $opens_url;
public $receivers_who_clicked_24h;
public $mail_subject;
public $preview_url;
public $mail_id;
public $url;
public $sendtime;
public $sender_name;
public $unique_html_clicks;
public $receivers_who_clicked;
public $get_view_online_link;
public $bounces_url;
public $mail_url;
public $id;
public $sent;
public $sent_to_lists;
}
14 changes: 14 additions & 0 deletions src/ReportManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Gan;

/**
* Entity manager for the Report entity.
*/
class ReportManager extends EntityManager
{
protected $basePath = 'reports';
protected $entityClass = '\Gan\Report';
protected $writableFields = [];
protected $lookupField = 'report_id';
}
14 changes: 14 additions & 0 deletions src/Unsubscribe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Gan;

/**
* Represents a unsubscribe object.
*/
class Unsubscribe extends Entity
{
public $url;
public $contact;
public $contact_url;
public $created;
}
34 changes: 34 additions & 0 deletions src/UnsubscribeManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Gan;

/**
* Entity manager for the Unsubscribe entity.
*/
class UnsubscribeManager extends EntityManager
{
protected $basePath = 'reports';
protected $entityClass = '\Gan\Unsubscribe';
protected $writableFields = [];
protected $lookupField = 'report_id';

protected function getPath($id)
{
return rtrim($this->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;
}