Test Failed
Push — master ( cf61d2...d4f0dd )
by Robin
02:18
created

CampaignClient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 45
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A registerFundraisingPage() 0 4 1
A retrieve() 0 4 1
A pages() 0 4 1
A getAllByCharityId() 0 4 1
1
<?php
2
3
namespace Konsulting\JustGivingApiSdk\ResourceClients;
4
5
use Konsulting\JustGivingApiSdk\ResourceClients\Models\RegisterCampaignRequest;
6
7
class CampaignClient extends BaseClient
8
{
9
    protected $aliases = [
10
        'registerFundraisingPage' => 'RegisterCampaignFundraisingPage',
11
        'retrieve'                => 'GetCampaignDetails',
12
        'pages'                   => 'GetPagesForCampaign',
13
        'create'                  => 'CreateCampaign',
14
        'getAllByCharityId'       => 'GetCampaignsByCharityId',
15
    ];
16
17
    public function retrieve($charityName, $campaignName)
18
    {
19
        return $this->get("campaigns/" . $charityName . "/" . $campaignName);
20
    }
21
22
    /**
23
     * Test context account is not authorised to create a new campaign.
24
     *
25
     * @codeCoverageIgnore
26
     */
27
    public function create(RegisterCampaignRequest $registerCampaignRequest)
28
    {
29
        return $this->post('campaigns', $registerCampaignRequest);
30
    }
31
32
    public function pages($charityShortName, $campaignShortUrl)
33
    {
34
        return $this->get("campaigns/" . $charityShortName . "/" . $campaignShortUrl . "/pages");
35
    }
36
37
    public function getAllByCharityId($charityId)
38
    {
39
        return $this->get('campaigns/' . $charityId);
40
    }
41
42
    /**
43
     * Test context account is not authorised to create a new campaign.
44
     *
45
     * @codeCoverageIgnore
46
     */
47
    public function registerFundraisingPage($registerCampaignFundraisingPageRequest)
48
    {
49
        return $this->post('campaigns', $registerCampaignFundraisingPageRequest);
50
    }
51
}
52