Refactor NPS tracking data fetching to use API call
[MAILPOET-1815]
This commit is contained in:
committed by
M. Shull
parent
7bc16e4ba7
commit
e3741def1d
27
lib/API/JSON/v1/Analytics.php
Normal file
27
lib/API/JSON/v1/Analytics.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\API\JSON\v1;
|
||||
|
||||
use MailPoet\Analytics\Reporter;
|
||||
use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\Config\AccessControl;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Analytics extends APIEndpoint {
|
||||
|
||||
/** @var Reporter */
|
||||
private $reporter;
|
||||
|
||||
public $permissions = array(
|
||||
'global' => AccessControl::NO_ACCESS_RESTRICTION
|
||||
);
|
||||
|
||||
function __construct(Reporter $reporter) {
|
||||
$this->reporter = $reporter;
|
||||
}
|
||||
|
||||
function getTrackingData() {
|
||||
return $this->successResponse($this->reporter->getTrackingData());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user