Пример #1
0
 /**
  * @param $path
  * @param string $method
  * @param null $body
  * @param array $extraHeaders
  * @return \stdClass
  * @throws ApiException
  */
 protected function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
 {
     $this->init();
     if (!$this->storage || !$this->storage->hasAccessToken($this->getServiceName())) {
         throw new ApiException('No Access Token defined, use setAccessToken or use connect before calling this method');
     }
     // Add format :
     strpos($path, '?') === false ? $path .= '?' : ($path .= '&');
     $path .= 'format=json';
     return json_decode($this->service->request($path, $method, $body, $extraHeaders));
 }
Пример #2
0
 /**
  * Check if we received a response with Authorization
  */
 public function hasAccessToken($service)
 {
     return $this->storage->hasAccessToken($service);
 }