1 | <?php |
||
21 | class EventClient |
||
22 | { |
||
23 | protected $headers = ['Content-type' => 'application/json']; |
||
24 | /** |
||
25 | * @var HttpMethodsClient |
||
26 | */ |
||
27 | protected $httpClient; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $apiRootUrl; |
||
33 | |||
34 | /** |
||
35 | * @var RepresentProcessorInterface |
||
36 | */ |
||
37 | protected $representProcessor; |
||
38 | |||
39 | /** |
||
40 | * RequestNotificationType constructor. |
||
41 | * |
||
42 | * @param string $apiRootUrl |
||
43 | * @param HttpMethodsClient $httpClient |
||
44 | * @param RepresentProcessorInterface $representProcessor |
||
45 | */ |
||
46 | 1 | public function __construct( |
|
65 | |||
66 | /** |
||
67 | * @param PagerDutyEntityInterface $pagerDutyEntity |
||
68 | * |
||
69 | * @return ResponseInterface |
||
70 | * |
||
71 | * @throws EventApiResponseErrorException |
||
72 | */ |
||
73 | 1 | public function post(PagerDutyEntityInterface $pagerDutyEntity) |
|
91 | |||
92 | /** |
||
93 | * @return HttpMethodsClient |
||
94 | */ |
||
95 | 1 | public function getHttpClient() |
|
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | 1 | public function getApiRootUrl() |
|
107 | |||
108 | /** |
||
109 | * @return RepresentProcessorInterface |
||
110 | */ |
||
111 | 1 | public function getRepresentProcessor() |
|
115 | |||
116 | /** |
||
117 | * @param HttpMethodsClient $httpClient |
||
118 | */ |
||
119 | 1 | protected function setHttpClient($httpClient) |
|
123 | |||
124 | /** |
||
125 | * @param string $apiRootUrl |
||
126 | */ |
||
127 | 1 | protected function setApiRootUrl($apiRootUrl) |
|
131 | |||
132 | /** |
||
133 | * @param RepresentProcessorInterface $representProcessor |
||
134 | */ |
||
135 | 1 | protected function setRepresentProcessor($representProcessor) |
|
139 | |||
140 | /** |
||
141 | * add basic representation for EventClient. |
||
142 | */ |
||
143 | 1 | protected function addBasicRepresentation() |
|
147 | |||
148 | /** |
||
149 | * @return HttpMethodsClient |
||
150 | */ |
||
151 | protected function createHttpClient() |
||
160 | |||
161 | /** |
||
162 | * @return RepresentProcessor |
||
163 | */ |
||
164 | protected function createRepresentProcessor() |
||
168 | |||
169 | /** |
||
170 | * @param PagerDutyEntityInterface $pagerDutyEntity |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | 1 | private function getResourceUrl(PagerDutyEntityInterface $pagerDutyEntity) |
|
182 | |||
183 | /** |
||
184 | * @param $response |
||
185 | * |
||
186 | * @return bool|\stdClass |
||
187 | * |
||
188 | * @throws EventApiResponseErrorException |
||
189 | */ |
||
190 | 1 | private function performeResponse($response) |
|
200 | |||
201 | /** |
||
202 | * @param stdClass $data |
||
203 | * @throws EventApiResponseErrorException |
||
204 | */ |
||
205 | private static function validateResponseData(stdClass $data) |
||
211 | } |
||
212 |