Passed
Push — master ( 7fc19c...13cdec )
by Toby
04:11 queued 10s
created

EventTicketTypeRequest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 20
dl 0
loc 109
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 10 1
A update() 0 11 1
A __construct() 0 3 1
A getInstance() 0 3 1
A create() 0 11 1
1
<?php
2
/**
3
 * Event Ticket Type Request class
4
 */
5
namespace Twigger\UnionCloud\API\Request;
6
7
8
use Twigger\UnionCloud\API\Auth\Authentication;
9
use Twigger\UnionCloud\API\Configuration;
10
use Twigger\UnionCloud\API\Response\EventTicketResponse;
11
use Twigger\UnionCloud\API\Response\EventTicketTypeResponse;
12
13
/**
14
 * Class Event Ticket Type Request
15
 *
16
 * @package Twigger\UnionCloud\API\Events\EventTicketTypes
17
 *
18
 * @license    https://opensource.org/licenses/GPL-3.0  GNU Public License v3
19
 *
20
 * @author     Toby Twigger <[email protected]>
21
 *
22
 */
23
class EventTicketTypeRequest extends BaseRequest implements IRequest
24
{
25
    /**
26
     * Event Ticket Types Request constructor.
27
     *
28
     * @param Authentication $authentication
29
     * @param Configuration $configuration
30
     */
31
    public function __construct($authentication, $configuration)
32
    {
33
        parent::__construct($authentication, $configuration, EventTicketTypeResponse::class);
34
    }
35
36
37
    /**
38
     * Gets the current instance
39
     *
40
     * @return $this
41
     *
42
     */
43
    public function getInstance()
44
    {
45
        return $this;
46
    }
47
48
49
50
    /*
51
    |--------------------------------------------------------------------------
52
    | API Endpoint Definitions
53
    |--------------------------------------------------------------------------
54
    |
55
    | Define your API endpoints below here
56
    |
57
    */
58
59
    /**
60
     * Create a new Event Ticket Type
61
     *
62
     * @param integer $eventID ID of the event to create the ticket type for
63
     * @param mixed[] $ticketData Data to construct the Ticket Type
64
     *
65
     * @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
66
     *
67
     * @throws \GuzzleHttp\Exception\GuzzleException
68
     * @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
69
     * @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
70
     */
71
    public function create($eventID, $ticketData)
72
    {
73
        $this->setAPIParameters(
74
            'events/'.$eventID.'/event_ticket_types',
75
            'POST',
76
            $ticketData
77
        );
78
79
        $this->call();
80
81
        return $this->getReturnDetails();
82
    }
83
84
    /**
85
     * Update an Event Ticket Type
86
     *
87
     * @param integer $eventID ID of the event
88
     * @param integer $eventTicketTypeID ID of the event ticket type
89
     * @param mixed[] $ticketData Data of the ticket to update
90
     *
91
     * @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
92
     *
93
     * @throws \GuzzleHttp\Exception\GuzzleException
94
     * @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
95
     * @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
96
     */
97
    public function update($eventID, $eventTicketTypeID, $ticketData)
98
    {
99
        $this->setAPIParameters(
100
            'events/'.$eventID.'/event_ticket_types/'.$eventTicketTypeID,
101
            'PUT',
102
            $ticketData
103
        );
104
105
        $this->call();
106
107
        return $this->getReturnDetails();
108
    }
109
110
    /**
111
     * Delete an Event Ticket Type
112
     *
113
     * @param integer $eventID ID of the event
114
     * @param integer $eventTicketTypeID ID of the event ticket type
115
     *
116
     * @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
117
     *
118
     * @throws \GuzzleHttp\Exception\GuzzleException
119
     * @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
120
     * @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
121
     */
122
    public function delete($eventID, $eventTicketTypeID)
123
    {
124
        $this->setAPIParameters(
125
            'events/'.$eventID.'/event_ticket_types/'.$eventTicketTypeID,
126
            'DELETE'
127
        );
128
129
        $this->call();
130
131
        return $this->getReturnDetails();
132
    }
133
}