Refactor NPS tracking data fetching to use API call

[MAILPOET-1815]
This commit is contained in:
Rostislav Wolny
2019-03-08 13:43:53 +01:00
committed by M. Shull
parent 7bc16e4ba7
commit e3741def1d
7 changed files with 85 additions and 42 deletions

View 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());
}
}