| @@ 185-200 (lines=16) @@ | ||
| 182 | * @param array $params |
|
| 183 | * @return array |
|
| 184 | */ |
|
| 185 | protected function sendPostRequest($resource, $params) |
|
| 186 | { |
|
| 187 | $response = $this->sendRequest( |
|
| 188 | 'POST', |
|
| 189 | $this->getServiceUrl($resource), |
|
| 190 | [ |
|
| 191 | 'headers' => [ |
|
| 192 | 'Accept' => 'application/x-yametrika+json', |
|
| 193 | 'Content-Type' => 'application/x-yametrika+json', |
|
| 194 | ], |
|
| 195 | 'json' => $params |
|
| 196 | ] |
|
| 197 | ); |
|
| 198 | ||
| 199 | return $this->getDecodedBody($response->getBody()); |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * Send PUT request to API resource |
|
| @@ 209-224 (lines=16) @@ | ||
| 206 | * @param array $params |
|
| 207 | * @return array |
|
| 208 | */ |
|
| 209 | protected function sendPutRequest($resource, $params) |
|
| 210 | { |
|
| 211 | $response = $this->sendRequest( |
|
| 212 | 'PUT', |
|
| 213 | $this->getServiceUrl($resource), |
|
| 214 | [ |
|
| 215 | 'headers' => [ |
|
| 216 | 'Accept' => 'application/x-yametrika+json', |
|
| 217 | 'Content-Type' => 'application/x-yametrika+json', |
|
| 218 | ], |
|
| 219 | 'json' => $params |
|
| 220 | ] |
|
| 221 | ); |
|
| 222 | ||
| 223 | return $this->getDecodedBody($response->getBody()); |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * Send DELETE request to API resource |
|
| @@ 232-246 (lines=15) @@ | ||
| 229 | * @param string $resource |
|
| 230 | * @return array |
|
| 231 | */ |
|
| 232 | protected function sendDeleteRequest($resource) |
|
| 233 | { |
|
| 234 | $response = $this->sendRequest( |
|
| 235 | 'DELETE', |
|
| 236 | $this->getServiceUrl($resource), |
|
| 237 | [ |
|
| 238 | 'headers' => [ |
|
| 239 | 'Accept' => 'application/x-yametrika+json', |
|
| 240 | 'Content-Type' => 'application/x-yametrika+json', |
|
| 241 | ] |
|
| 242 | ] |
|
| 243 | ); |
|
| 244 | ||
| 245 | return $this->getDecodedBody($response->getBody()); |
|
| 246 | } |
|
| 247 | } |
|
| 248 | ||