Completed
Push — master ( 8e5e96...3d7154 )
by Hector
06:06 queued 02:56
created

TailoredAudienceMemberships::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Hborras\TwitterAdsSDK\TwitterAds\TailoredAudience;
4
5
use Hborras\TwitterAdsSDK\TwitterAds;
6
use Hborras\TwitterAdsSDK\TwitterAds\Account;
7
use Hborras\TwitterAdsSDK\TwitterAds\Batch;
8
9
/**
10
 * Represents a Tailored Audience membership batch
11
 * Supports: POST
12
 *
13
 * @since 2016-06-27
14
 */
15
final class TailoredAudienceMemberships extends Batch
16
{
17
    const MAX_BATCH_SIZE = 100;
18
    const RESOURCE = 'tailored_audience_memberships';
19
    const OPERATION = 'Update';
20
21
    public function __construct(Account $account=null, $members=[])
22
    {
23
        parent::__construct($account, self::MAX_BATCH_SIZE, $members);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function save()
30
    {
31
        return $this->fromResponse(
32
            $this->getAccount()->getTwitterAds()->post(self::RESOURCE, [
33
                'operation_type' => self::OPERATION,
34
                'params'         => $this->toParams(),
35
        ]));
36
    }
37
}
38