Add ga campaign to api response
[MAILPOET-2397]
This commit is contained in:
committed by
Jack Kitterhing
parent
200a9b1edb
commit
ef79b7efbb
@ -31,6 +31,7 @@ class NewslettersResponseBuilder {
|
||||
'options' => $this->buildOptions($newsletter),
|
||||
'queue' => ($queue = $newsletter->getLatestQueue()) ? $this->buildQueue($queue) : false, // false for BC
|
||||
'unsubscribe_token' => $newsletter->getUnsubscribeToken(),
|
||||
'ga_campaign' => $newsletter->getGaCampaign(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,12 @@ class NewsletterEntity {
|
||||
*/
|
||||
private $unsubscribe_token;
|
||||
|
||||
/**
|
||||
* @Column(type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $ga_campaign;
|
||||
|
||||
/**
|
||||
* @ManyToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
||||
* @var NewsletterEntity|null
|
||||
@ -302,6 +308,21 @@ class NewsletterEntity {
|
||||
return $this->unsubscribe_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGaCampaign() {
|
||||
return $this->ga_campaign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ga_campaign
|
||||
*/
|
||||
public function setGaCampaign($ga_campaign) {
|
||||
$this->ga_campaign = $ga_campaign;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string|null $unsubscribe_token
|
||||
*/
|
||||
|
@ -138,8 +138,7 @@ class NewslettersTest extends \MailPoetTest {
|
||||
ContainerWrapper::getInstance()->get(NewslettersRepository::class),
|
||||
ContainerWrapper::getInstance()->get(NewslettersResponseBuilder::class),
|
||||
ContainerWrapper::getInstance()->get(PostNotificationScheduler::class),
|
||||
ContainerWrapper::getInstance()->get(MetaInfo::class),
|
||||
$this->subscription_url_factory
|
||||
ContainerWrapper::getInstance()->get(MetaInfo::class)
|
||||
);
|
||||
$response = $this->endpoint->get(['id' => $this->newsletter->id]);
|
||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||
|
Reference in New Issue
Block a user