Completed
Pull Request — master (#8)
by
unknown
03:08
created

TailoredAudienceMemberships   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A save() 0 8 1
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