Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
requestyandex.php
1<?
2
4
6
8{
9 const TYPE_CODE = 'yandex';
10 const REST_METHOD_PREFIX = 'seo.client.ads.yandex';
11
12 protected function directQuery(array $params = array())
13 {
14 $this->endpoint = $params['endpoint'];
15
16 $url = 'https://api-audience.yandex.ru/v1/management/';
17 $url .= $params['endpoint'];
18
19 $clientParameters = is_array($params['fields']) ? $params['fields'] : array();
20 $this->client->setHeader('Authorization', 'OAuth ' . $this->adapter->getToken());
21
22 if ($params['method'] == 'GET')
23 {
24 $url .= '?' . http_build_query($clientParameters, "", "&");
25 return $this->client->get($url);
26 }
27 elseif ($params['method'] == 'DELETE')
28 {
29 return $this->client->delete($url, $clientParameters, true);
30 }
31 else
32 {
33 return $this->client->post($url, $clientParameters, true);
34 }
35 }
36}