Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Add: DynamicTextAdTargetsService
Browse files Browse the repository at this point in the history
  • Loading branch information
nk2ge5k committed Aug 31, 2016
1 parent 35d9a4f commit ec945f2
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 24 deletions.
25 changes: 22 additions & 3 deletions DirectApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use directapi\services\keywords\KeywordsService;
use directapi\services\sitelinks\SitelinksService;
use directapi\services\vcards\VCardsService;
use directapi\services\dynamictextadtargets\DynamicTextAdTargetsService;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\CachedReader;
Expand Down Expand Up @@ -102,6 +103,10 @@ class DirectApiService
* @var ClientsService
*/
private $clientsService;
/**
* @var DynamicTextAdTargetsService
*/
private $dynamicTextAdTargetsService;
/**
* @var CacheInterface
*/
Expand Down Expand Up @@ -302,7 +307,8 @@ public function getVCardsService()
/**
* @return DictionariesService
*/
public function getDictionariesService() {
public function getDictionariesService()
{
if (!$this->dictionariesService){
$this->dictionariesService = new DictionariesService($this);
}
Expand All @@ -312,7 +318,8 @@ public function getDictionariesService() {
/**
* @return AdImagesService
*/
public function getAdImagesService(){
public function getAdImagesService()
{
if ( !$this->adImagesService ) {
$this->adImagesService = new AdImagesService($this);
}
Expand All @@ -322,13 +329,25 @@ public function getAdImagesService(){
/**
* @return ClientsService
*/
public function getClientsService() {
public function getClientsService()
{
if ( !$this->clientsService ) {
$this->clientsService = new ClientsService($this);
}
return $this->clientsService;
}

/**
* @return DynamicTextAdTargetsService
*/
public function getDynamicTextAdTargetsService()
{
if ( !$this->dynamicTextAdTargetsService ) {
$this->dynamicTextAdTargetsService = new DynamicTextAdTargetsService($this);
}
return $this->dynamicTextAdTargetsService;
}

/**
* @param string $serviceName
* @param string $method
Expand Down
41 changes: 32 additions & 9 deletions services/dynamictextadtargets/DynamicTextAdTargetsService.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
<?php


namespace directapi\dynamictextadtargets;
namespace directapi\services\dynamictextadtargets;


use directapi\common\criterias\LimitOffset;
use directapi\dynamictextadtargets\models\SetBidsItem;
use directapi\dynamictextadtargets\models\WebpagesSelectionCriteria;
use directapi\services\dynamictextadtargets\models\SetBidsItem;
use directapi\services\dynamictextadtargets\models\WebpagesSelectionCriteria;
use directapi\services\BaseService;

class DynamicTextAdTargetsService extends BaseService
{
const SERVICE = 'DynamicTextAdTargets';
const SERVICE = 'DynamicTextAdTargets';

const WEBPAGES = 'Webpages';

/**
* @param array $webpages
*
* @return array
*/
public function add( array $webpages ) {

public function add( array $webpages )
{
return parent::doAdd(
[
self::WEBPAGES => $webpages
]
);
}

/**
Expand All @@ -29,17 +36,33 @@ public function add( array $webpages ) {
*
* @return array
*/
public function get( WebpagesSelectionCriteria $criteria, array $fieldNames, LimitOffset $page = null ) {
public function get( WebpagesSelectionCriteria $criteria, array $fieldNames, LimitOffset $page = null )
{

$page = $page === NULL ? LimitOffset::init(0, 10000) : $page;

return parent::doGet(
[
'SelectionCriteria' => $criteria,
'FieldNames' => $fieldNames,
'Page' => $page
],
self::WEBPAGES,
NULL
);
}

/**
* @param SetBidsItem[] $bids
*
* @return array
*/
public function setBids( array $bids ) {

public function setBids( array $bids )
{
$params = [
'Bids' => $bids
];
return $this->call('setBids', $params);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\enum;
namespace directapi\services\dynamictextadtargets\enum;


use directapi\components\Enum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\enum;
namespace directapi\services\dynamictextadtargets\enum;


use directapi\components\Enum;
Expand Down
2 changes: 1 addition & 1 deletion services/dynamictextadtargets/enum/WebpageFieldEnum.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\enum;
namespace directapi\services\dynamictextadtargets\enum;


use directapi\components\Enum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\enum;
namespace directapi\services\dynamictextadtargets\enum;


use directapi\components\Enum;
Expand Down
2 changes: 1 addition & 1 deletion services/dynamictextadtargets/enum/WebpageTypeEnum.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\enum;
namespace directapi\services\dynamictextadtargets\enum;


use directapi\components\Enum;
Expand Down
2 changes: 1 addition & 1 deletion services/dynamictextadtargets/models/SetBidsItem.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\models;
namespace directapi\services\dynamictextadtargets\models;


use directapi\common\enum\PriorityEnum;
Expand Down
2 changes: 1 addition & 1 deletion services/dynamictextadtargets/models/WebpageAddItem.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace directapi\dynamictextadtargets\models;
namespace directapi\services\dynamictextadtargets\models;


use directapi\common\enum\PriorityEnum;
Expand Down
6 changes: 3 additions & 3 deletions services/dynamictextadtargets/models/WebpageCondition.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php


namespace directapi\dynamictextadtargets\models;
namespace directapi\services\dynamictextadtargets\models;


use directapi\components\constraints\ArrayOf;
use directapi\components\Model;
use directapi\dynamictextadtargets\enum\StringConditionOperatorEnum;
use directapi\dynamictextadtargets\enum\WebpageConditionOperandEnum;
use directapi\services\dynamictextadtargets\enum\StringConditionOperatorEnum;
use directapi\services\dynamictextadtargets\enum\WebpageConditionOperandEnum;
use Symfony\Component\Validator\Constraints as Assert;

class WebpageCondition extends Model
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php


namespace directapi\dynamictextadtargets\models;
namespace directapi\services\dynamictextadtargets\models;


use directapi\components\Model;
use directapi\dynamictextadtargets\enum\WebpageStateSelectionEnum;
use directapi\services\dynamictextadtargets\enum\WebpageStateSelectionEnum;

class WebpagesSelectionCriteria extends Model
{
Expand Down

0 comments on commit ec945f2

Please sign in to comment.