@@ 204-219 (lines=16) @@ | ||
201 | * @param array $params |
|
202 | * @return array |
|
203 | */ |
|
204 | protected function sendPostRequest($resource, $params) |
|
205 | { |
|
206 | $response = $this->sendRequest( |
|
207 | 'POST', |
|
208 | $this->getServiceUrl($resource), |
|
209 | [ |
|
210 | 'headers' => [ |
|
211 | 'Accept' => 'application/x-yametrika+json', |
|
212 | 'Content-Type' => 'application/x-yametrika+json', |
|
213 | ], |
|
214 | 'json' => $params |
|
215 | ] |
|
216 | ); |
|
217 | ||
218 | return $this->getDecodedBody($response->getBody()); |
|
219 | } |
|
220 | ||
221 | /** |
|
222 | * Send PUT request to API resource |
|
@@ 228-243 (lines=16) @@ | ||
225 | * @param array $params |
|
226 | * @return array |
|
227 | */ |
|
228 | protected function sendPutRequest($resource, $params) |
|
229 | { |
|
230 | $response = $this->sendRequest( |
|
231 | 'PUT', |
|
232 | $this->getServiceUrl($resource), |
|
233 | [ |
|
234 | 'headers' => [ |
|
235 | 'Accept' => 'application/x-yametrika+json', |
|
236 | 'Content-Type' => 'application/x-yametrika+json', |
|
237 | ], |
|
238 | 'json' => $params |
|
239 | ] |
|
240 | ); |
|
241 | ||
242 | return $this->getDecodedBody($response->getBody()); |
|
243 | } |
|
244 | ||
245 | /** |
|
246 | * Send DELETE request to API resource |
|
@@ 251-265 (lines=15) @@ | ||
248 | * @param string $resource |
|
249 | * @return array |
|
250 | */ |
|
251 | protected function sendDeleteRequest($resource) |
|
252 | { |
|
253 | $response = $this->sendRequest( |
|
254 | 'DELETE', |
|
255 | $this->getServiceUrl($resource), |
|
256 | [ |
|
257 | 'headers' => [ |
|
258 | 'Accept' => 'application/x-yametrika+json', |
|
259 | 'Content-Type' => 'application/x-yametrika+json', |
|
260 | ] |
|
261 | ] |
|
262 | ); |
|
263 | ||
264 | return $this->getDecodedBody($response->getBody()); |
|
265 | } |
|
266 | } |
|
267 |