@@ 206-222 (lines=17) @@ | ||
203 | * @param array $params |
|
204 | * @return array |
|
205 | */ |
|
206 | protected function sendPostRequest($resource, $params) |
|
207 | { |
|
208 | $response = $this->sendRequest( |
|
209 | 'POST', |
|
210 | $this->getServiceUrl($resource), |
|
211 | [ |
|
212 | 'headers' => [ |
|
213 | 'Accept' => 'application/x-yametrika+json', |
|
214 | 'Content-Type' => 'application/x-yametrika+json', |
|
215 | 'Authorization' => 'OAuth ' . $this->getAccessToken(), |
|
216 | ], |
|
217 | 'json' => $params |
|
218 | ] |
|
219 | ); |
|
220 | ||
221 | return $this->getDecodedBody($response->getBody()); |
|
222 | } |
|
223 | ||
224 | /** |
|
225 | * Send PUT request to API resource |
|
@@ 231-247 (lines=17) @@ | ||
228 | * @param array $params |
|
229 | * @return array |
|
230 | */ |
|
231 | protected function sendPutRequest($resource, $params) |
|
232 | { |
|
233 | $response = $this->sendRequest( |
|
234 | 'PUT', |
|
235 | $this->getServiceUrl($resource), |
|
236 | [ |
|
237 | 'headers' => [ |
|
238 | 'Accept' => 'application/x-yametrika+json', |
|
239 | 'Content-Type' => 'application/x-yametrika+json', |
|
240 | 'Authorization' => 'OAuth ' . $this->getAccessToken(), |
|
241 | ], |
|
242 | 'json' => $params |
|
243 | ] |
|
244 | ); |
|
245 | ||
246 | return $this->getDecodedBody($response->getBody()); |
|
247 | } |
|
248 | ||
249 | /** |
|
250 | * Send DELETE request to API resource |