Yesterday I posted a quick example of integrating Google's Docs API with ColdFusion. I went ahead and wrapped up the code in a simple set of CFCs. There is a base CFC that handles authentication along with a docs CFC that handles the real interaction. Here is some sample code:
<cfset docs = createObject("component", "docs")> <cfset docs.authenticate("email@example.com","foo")>
This creates an instance of the CFC and logs the user on. If authentication fails, a CF error is thrown, so normally this would probably be wrapped in cfry/cfcatch.
To get all your documents, you would run:
<cfset mydocs = docs.getDocumentList()>
This returns a query. One of the columns contains the sourceurl, which can be used to grab the source:
<cfset content = docs.download(mydocs.sourceurl)> <cfoutput>result is #content#</cfoutput>
The getDocumentList() supports 2 filters (Google supports more). You can use max to limit the number of results:
<cfset mydocs = docs.getDocumentList(max=9)>
You can also apply a title filter:
<cfset mydocs = docs.getDocumentList(title="Blog")>
The title filter is a search, not a direct match.