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