public function getAccessToken($data = null)
 {
     if (!$this->clientId || !$this->email || !$this->privateKey) {
         throw new Exception('You must provide the clientId, email and a path to your private Key');
     }
     $jwt = $this->generateSignedJWT();
     $params = array('grant_type' => self::GRANT_TYPE, 'assertion' => $jwt);
     $auth = Http::curl(Oauth::TOKEN_URL, $params, true);
     return json_decode($auth, $this->assoc);
 }
 public function revokeAccess($token)
 {
     $params = array('token' => $token);
     $data = Http::curl(self::REVOKE_URL, $params);
     return json_decode($data, $this->assoc);
 }
 protected function _query($params = array())
 {
     if (!$this->accessToken || !$this->accountId) {
         throw new Exception('You must provide the accessToken and an accountId');
     }
     $_params = array_merge($this->defaultQueryParams, array('access_token' => $this->accessToken, 'ids' => $this->accountId));
     $queryParams = array_merge($_params, $params);
     $data = Http::curl(self::API_URL, $queryParams);
     return json_decode($data, $this->assoc);
 }