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

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