Example #1
0
 /**
  * @param string $action
  * @param array  $parameter
  * @return Response|bool
  */
 public function send($action, array $parameter)
 {
     if (!$this->connection->isValid()) {
         return false;
     }
     $action = Actions::loadClass($action);
     $action->setParameter($parameter);
     $url = $this->buildRequestUrl($action, array_merge(['token' => $this->connection->getToken()], $action->getRenderedRequestParams()));
     $tries = 1;
     do {
         $response = $this->executeRequest($url);
         $response = Response::parseGuzzleResponse($response, $action);
         if ($response->getStatus() === true || $response->getStatus() === false && $response->getError() != Response::ERROR_RATE_LIMITED) {
             break;
         }
         ++$tries;
     } while ($tries <= $this->connection->getLimitRetries());
     return $response;
 }