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