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

CharityClient   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 64
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteFundraisingPageAttribution() 0 4 1
A updateFundraisingPageAttribution() 0 4 1
A appendFundraisingPageAttribution() 0 4 1
A getFundraisingPageAttribution() 0 4 1
A getById() 0 4 1
A authenticate() 0 4 1
A getEventsByCharityId() 0 4 1
A getDonations() 0 4 1
A categories() 0 4 1
1
<?php
2
3
namespace Konsulting\JustGivingApiSdk\ResourceClients;
4
5
use Konsulting\JustGivingApiSdk\ResourceClients\Models\AuthenticateCharityAccountRequest;
6
use Konsulting\JustGivingApiSdk\ResourceClients\Models\UpdateFundraisingPageAttributionRequest;
7
8
class CharityClient extends BaseClient
9
{
10
    protected $aliases = [
11
        'getById'                          => 'GetCharityById',
12
        'authenticate'                     => 'AuthenticateCharityAccount',
13
        'getEventsByCharityId'             => 'GetEventsByCharityId',
14
        'getDonations'                     => 'GetCharityDonations',
15
        'deleteFundraisingPageAttribution' => 'CharityDeleteFundraisingPageAttribution',
16
        'updateFundraisingPageAttribution' => 'CharityUpdateFundraisingPageAttribution',
17
        'appendFundraisingPageAttribution' => 'CharityAppendToFundraisingPageAttribution',
18
        'getFundraisingPageAttribution'    => 'CharityGetFundraisingPageAttribution',
19
        'categories'                       => 'GetCharityCategories',
20
    ];
21
22
    public function getById($charityId)
23
    {
24
        return $this->get("charity/" . $charityId);
25
    }
26
27
    public function authenticate(AuthenticateCharityAccountRequest $authenticateRequest)
28
    {
29
        return $this->post("charity/authenticate", $authenticateRequest);
30
    }
31
32
    public function getEventsByCharityId($charityId)
33
    {
34
        return $this->get("charity/" . $charityId . "/events");
35
    }
36
37
    public function getDonations($charityId)
38
    {
39
        return $this->get("charity/" . $charityId . "/donations");
40
    }
41
42
    // Test account does not have permission to edit charity fundraising pages.
43
    // @codeCoverageIgnoreStart
44
45
    public function deleteFundraisingPageAttribution($charityId, $pageShortName)
46
    {
47
        return $this->delete("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution");
48
    }
49
50
    public function updateFundraisingPageAttribution($charityId, $pageShortName, UpdateFundraisingPageAttributionRequest $updateRequest)
51
    {
52
        return $this->put("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution", $updateRequest);
53
    }
54
55
    public function appendFundraisingPageAttribution($charityId, $pageShortName, UpdateFundraisingPageAttributionRequest $updateRequest)
56
    {
57
        return $this->Post("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution", $updateRequest);
58
    }
59
60
    public function getFundraisingPageAttribution($charityId, $pageShortName)
61
    {
62
        return $this->get("charity/" . $charityId . "/pages/" . $pageShortName . "/attribution");
63
    }
64
65
    // @codeCoverageIgnoreEnd
66
67
    public function categories()
68
    {
69
        return $this->get("charity/categories");
70
    }
71
}
72