/** * Creates a new OAuth server client and attaches to authorization broker. * * @return Authorization */ protected function createClient() { $this->client = new OAuthServer(['identifier' => Configuration::get('key'), 'secret' => Configuration::get('secret'), 'callback_uri' => Configuration::get('callbackUrl'), 'name' => Configuration::get('name'), 'expiration' => Configuration::get('expiration'), 'scope' => Configuration::get('scope')]); return $this; }
/** * Retrieves http response for a given request. * * @param RequestInterface $request * * @return object * @throws Exceptions\Exception */ protected function sendRequest(RequestInterface $request) { try { $response = $this->httpClient->send($request, ['multipart' => $this->multipartResources, 'proxy' => Configuration::get('proxy')]); $this->multipartResources = []; return json_decode($response->getBody()); } catch (RequestException $e) { $this->throwRequestException($e); } }
/** * Creates fully qualified domain from given path. * * @param string $path * * @return string */ protected function getUrlFromPath($path = '/') { return Configuration::get('domain') . '/' . Configuration::get('version') . '/' . ltrim($path, '/'); }