Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

69 lines (52 sloc) 2.248 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Google Base Class by John Nunemaker</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Google Base Class</h1>
<p>Easy Google Authentication and Requests.</p>
<ul id="nav">
<li><a href="rdoc/">Docs</a></li>
<li><a href="http://rubyforge.org/projects/googlebase/">Rubyforge Page</a></li>
</ul>
</div>
<div id="content">
<p>Google Base Class is a base for authenticating to google and making requests to google services.</p>
<h2>Installation</h2>
<pre><code>sudo gem install googlebase</code></pre>
<h2>Usage</h2>
<h3>Establish A Connection</h3>
<p>The code below shows how to use the gem by itself. It checks if username and password are correct (raising Google::LoginError on FAIL) and stores the session id internally. Then you can make requests and the session id is automatically passed in a cookie.</p>
<pre><code class="ruby">require 'google/base'
Google::Base.establish_connection('username', 'password')
Google::Base.get('http://google.com/path/to/whatever/')</code></pre>
<h3>Inheritance</h3>
<p>This example takes things a bit farther and shows how to use this class simply as a base to get some methods for free and then wrap whatever google service you would like.</p>
<pre><code>require 'google/base'
Google::Base.establish_connection('username', 'password')
module Google
module Reader
class Base &lt; Google::Base
class &lt;&lt; self
def get_token
get("http://www.google.com/reader/api/0/token")
end
end
end
end
end
puts Google::Reader::Base.get_token</code></pre>
</div>
<div id="footer">
<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p>
</div>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">_uacct = "UA-85301-15"; urchinTracker();</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.