EventTicketTypeRequest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 21
dl 0
loc 110
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getInstance() 0 3 1
A delete() 0 10 1
A update() 0 11 1
A create() 0 12 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
        $this->setContentType('application/json');
79
80
        $this->call();
81
82
        return $this->getReturnDetails();
83
    }
84
85
    /**
86
     * Update an Event Ticket Type
87
     *
88
     * @param integer $eventID ID of the event
89
     * @param integer $eventTicketTypeID ID of the event ticket type
90
     * @param mixed[] $ticketData Data of the ticket to update
91
     *
92
     * @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
93
     *
94
     * @throws \GuzzleHttp\Exception\GuzzleException
95
     * @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
96
     * @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
97
     */
98
    public function update($eventID, $eventTicketTypeID, $ticketData)
99
    {
100
        $this->setAPIParameters(
101
            'events/'.$eventID.'/event_ticket_types/'.$eventTicketTypeID,
102
            'PUT',
103
            $ticketData
104
        );
105
106
        $this->call();
107
108
        return $this->getReturnDetails();
109
    }
110
111
    /**
112
     * Delete an Event Ticket Type
113
     *
114
     * @param integer $eventID ID of the event
115
     * @param integer $eventTicketTypeID ID of the event ticket type
116
     *
117
     * @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
118
     *
119
     * @throws \GuzzleHttp\Exception\GuzzleException
120
     * @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
121
     * @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
122
     */
123
    public function delete($eventID, $eventTicketTypeID)
124
    {
125
        $this->setAPIParameters(
126
            'events/'.$eventID.'/event_ticket_types/'.$eventTicketTypeID,
127
            'DELETE'
128
        );
129
130
        $this->call();
131
132
        return $this->getReturnDetails();
133
    }
134
}