Esempio n. 1
0
 /**
  * @param array $params
  *
  * @return array|bool|float|int|string
  * @throws \Exception
  */
 public function get(array $params)
 {
     $response = $this->client->getClient()->get('/stat/geo.json', null, $params)->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     return $response->json();
 }
Esempio n. 2
0
 /**
  * @param $delegateLogin
  *
  * @return array|bool|float|int|string
  * @throws \Exception
  */
 public function deleteDelegate($delegateLogin)
 {
     $response = $this->client->getClient()->delete('/delegate/' . $delegateLogin . '.json')->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $delegates = $response->json();
     return $delegates;
 }
Esempio n. 3
0
 /**
  * @param $login
  *
  * @return array|bool|float|int|string
  * @throws \Exception
  */
 public function deleteAccount($login)
 {
     $response = $this->client->getClient()->delete('/account/' . $login . '.json')->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $accounts = $response->json();
     return $accounts;
 }
Esempio n. 4
0
 public function refreshToken($refresh_token)
 {
     $options = array('auth' => array($this->clientId, $this->secretKey));
     $body = array('grant_type' => 'refresh_token', 'client_id' => $this->clientId, 'refresh_token' => $refresh_token);
     $url = 'https://o2.mail.ru/token';
     try {
         $response = $this->client->getClient()->post($url, null, $body, $options)->send();
     } catch (\Exception $e) {
         return $e->getMessage() . $e->getCode() . $e->getLine();
     }
     /*$postBody = $response->getBody();*/
     return $response->json();
 }
Esempio n. 5
0
 /**
  * @param FilterModel $filter
  *
  * @return FilterModel
  * @throws \Exception
  */
 public function deleteFilter(FilterModel $filter)
 {
     $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/filter/" . $filter->getId() . ".json")->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $filter = $response->json();
     return new FilterModel($filter);
 }
Esempio n. 6
0
 /**
  * @param OperationModel $operation
  *
  * @return OperationModel
  * @throws \Exception
  */
 public function deleteOperation(OperationModel $operation)
 {
     $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/operation/" . $operation->getid() . ".json")->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $operation = $response->json();
     return new OperationModel($operation['operation']);
 }
Esempio n. 7
0
 /**
  * @param GrantModel $grant
  *
  * @return GrantModel
  * @throws \Exception
  */
 public function deleteGrant(GrantModel $grant)
 {
     $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/grant/" . $grant->getId() . ".json", null, $body)->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $grant = $response->json();
     return new GrantModel($grant['grant']);
 }
Esempio n. 8
0
 /**
  * @param CounterModel $counter
  *
  * @return array|bool|float|int|string
  * @throws \Exception
  */
 public function checkCounter(CounterModel $counter)
 {
     $response = $this->client->getClient()->get("/counter/" . $counter->getId() . "/check.json")->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $result = $response->json();
     return $result;
 }
Esempio n. 9
0
 /**
  * @param GoalModel $goal
  *
  * @return GoalModel
  * @throws \Exception
  */
 public function deleteGoal(GoalModel $goal)
 {
     $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/goal/" . $goal->getId() . ".json")->send();
     if ($response->getStatusCode() != 200) {
         throw new \Exception('invalid status code');
     }
     $goal = $response->json();
     return new GoalModel($goal['goal']);
 }