public function get_req_token() { $headers = array('Authorization' => $this->get_req_token_auth_header()); $url = self::OAUTH_BASE . self::OAUTH_REQTOKEN; $response = Sourcemap_Http_Client::do_get($url, null, $headers); $resp_data = false; if ($response->status_ok()) { parse_str($response->body, $resp_data); $resp_data = $resp_data; } return $resp_data; }
public function action_auth() { $this->layout->scripts = array('sourcemap-core', 'sourcemap-template', 'sourcemap-working', 'sourcemap-upload'); $this->layout->styles = array('assets/styles/style.css', 'assets/styles/sourcemap.less'); if (isset($_GET['oauth_token'], $_GET['oauth_verifier']) && ($secret = Session::instance()->get('oauth_token_secret'))) { $auth_tok = array('oauth_token' => $_GET['oauth_token'], 'oauth_verifier' => $_GET['oauth_verifier'], 'oauth_token_secret' => $secret); } else { throw new Exception('Invalid token/verifier.'); } $oauth = Google_Oauth::factory(Google_Oauth::SPREADSHEETS); $acc_token = $oauth->get_acc_token($auth_tok); $url = "https://spreadsheets.google.com/feeds/cells/0Aqwz6ZHrexb7dHNBa0tsVDhlX1N5MkVrV3FxczE2cmc/od6/private/full"; $oauth_header = $oauth->get_token_auth_header($acc_token, $url); $headers = array(); $headers = array('Authorization' => $oauth_header); $response = Sourcemap_Http_Client::do_get($url, null, $headers); $data = $response; }
public function fetch() { $response = Sourcemap_Http_Client::do_get($this->get_url(), $this->parameters, $this->headers); return $response->status_ok() ? $this->unserialize($response) : false; }
public static function get_list($oauth_acc_token) { $oauth = Google_Oauth::factory(Google_Oauth::SPREADSHEETS); $url = self::URL_BASE . self::URL_LIST; $oauth_header = $oauth->get_token_auth_header($oauth_acc_token, $url); $response = Sourcemap_Http_Client::do_get($url, null, array('Authorization' => $oauth_header)); if (!$response->status_ok()) { throw new Exception('Could not authorize.'); } return self::parse_list($response->body); }