/** * @param string $resource * @param string $method * @param array $params */ protected function setUri($resource, $method, array $params) { $query = array('access_token' => $this->oauth2Client->getAccessToken()); if ('GET' === $method || 'HEAD' === $method) { $query = array_merge($query, $params); } $this->request->setUri($this->configuration->getBaseUri() . $resource . '?' . $this->httpClient->buildQuery($query)); }
/** * @return Response */ public function requestAccessToken() { $this->prepareRequest(); $this->request->setUri($this->configuration->getBaseUri() . self::TOKEN_ENDPOINT); $this->request->setMethod('POST'); $payload = $this->httpClient->buildQuery(array('client_id' => $this->configuration->getClientId(), 'client_secret' => $this->configuration->getClientSecret(), 'grant_type' => $this->configuration->getGrantType(), 'username' => $this->configuration->getUsername(), 'password' => $this->configuration->getPassword(), 'company' => $this->configuration->getCompany())); $this->request->setPayload($payload); return $this->httpClient->send($this->request); }