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

CampaignClient::getAllByCharityId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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