Пример #1
0
 /**
  * {@inheritdoc}
  *
  * @return PromiseInterface
  */
 public function run(CommandInterface $command, $result = null)
 {
     $key = $command->getRequestMethod() === 'GET' ? 'query' : 'body';
     $options = [$key => []];
     if (!empty($params = $command->getParams())) {
         $options[$key] = array_merge($options[$key], $params);
     }
     if ($config = $this->getConfig()) {
         if (!empty($config->getSteamKey())) {
             $options[$key]['key'] = $config->getSteamKey();
         }
         $this->urlBuilder->setBaseUrl($config->getBaseSteamApiUrl());
     }
     $request = new Request($command->getRequestMethod(), $this->urlBuilder->build($command));
     return $this->client->sendAsync($request, $options);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function build(CommandInterface $command)
 {
     $uri = sprintf('%s/%s/%s/%s', rtrim($this->getBaseUrl()), $command->getInterface(), $command->getMethod(), $command->getVersion());
     return new Uri($uri);
 }