Skip to content
Browse files

Add a docbook entry for the JGoogle Package

  • Loading branch information...
1 parent 471b3a0 commit fa52de84a0716426923a57b9b0b47e4421ccbb46 @aaronschmitz aaronschmitz committed with LouisLandry Oct 10, 2012
Showing with 97 additions and 0 deletions.
  1. +2 −0 docs/manual/en-US/chapters/packages.xml
  2. +95 −0 docs/manual/en-US/chapters/packages/google.xml
View
2 docs/manual/en-US/chapters/packages.xml
@@ -15,6 +15,8 @@
<xi:include href="packages/github.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="packages/google.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
<xi:include href="packages/http.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="packages/input.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
View
95 docs/manual/en-US/chapters/packages/google.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../../Developer_Manual.ent">
+%BOOK_ENTITIES;
+]>
+<section id="chap-Joomla_Platform_Manual-Google">
+ <title>The Google Package</title>
+
+ <section>
+ <title>Using the Google Package</title>
+
+ <para>The Google package is designed to be a straightforward interface for working with various Google APIs. You can find a list of APIs and documentation for each API at <ulink
+ url="https://developers.google.com/products/">https://developers.google.com/products/.</ulink></para>
+
+ <section>
+ <title>Instantiating JGoogle</title>
+
+ <para>Instantiating JGoogle is easy:</para>
+
+ <programlisting>$google = new JGoogle;</programlisting>
+
+ <para>This creates a generic JGoogle object that can be used to instantiate objects for specific Google APIs.</para>
+
+ <para>Sometimes it is necessary to specify additional options. This can be done by injecting in a JRegistry object with your
+ preferred options:<programlisting>$options = new JRegistry;
+$options-&gt;set('clientid', 'google_client_id.apps.googleusercontent.com');
+$options-&gt;set('clientsecret', 'google_client_secret');
+
+$google = new JGoogle($options);</programlisting></para>
+ </section>
+
+ <section>
+ <title>Accessing the JGoogle APIs</title>
+
+ <para>The Google Package divides APIs into two types: data APIs and embed APIs. Data APIs use JHttp to send and receive data from Google.
+ Embed APIs output HTML, JavaScript, and XML in order to embed information from Google in a webpage.</para>
+
+ <para>The Google package is still incomplete, but there are five object APIs that have currently been
+ implemented:</para>
+
+ <para>Data: <simplelist>
+ <member>Google Calendar</member>
+
+ <member>Google AdSense</member>
+
+ <member>Google Picasa</member>
+ </simplelist></para>
+
+ <para>Data: <simplelist>
+ <member>Google Maps</member>
+
+ <member>Google Analytics</member>
+ </simplelist></para>
+
+ <para>Once a JGoogle object has been created, it is simple to use it to create objects for each individual API:<programlisting>$calendar = $google-&gt;data('calendar');</programlisting> or <programlisting>$analytics = $google-&gt;data('analytics');</programlisting></para>
+ </section>
+
+ <section>
+ <title>Using an API</title>
+
+ <para>See below for an example demonstrating the use of the Calendar API:<programlisting>$options = new JRegistry;
+
+// Client ID and Client Secret can be obtained through the Google API Console (https://code.google.com/apis/console/).
+$options-&gt;set('clientid', 'google_client_id.apps.googleusercontent.com');
+$options-&gt;set('clientsecret', 'google_client_secret');
+$options-&gt;set('redirecturi', JURI::current());
+
+$google = new JGoogle($options);
+
+// Get a calendar API object
+$calendar = $google->data('calendar');
+
+// If the client hasn't been authenticated via OAuth yet, redirect to the appropriate URL and terminate the program
+if (!$calendar->isAuth())
+{
+ JResponse::sendHeaders();
+ die();
+}
+
+// Create a new Google Calendar called "Hello World."
+$calendar->createCalendar('Hello World');</programlisting></para>
+ </section>
+
+ <section>
+ <title>More Information</title>
+
+ <para>The following resources contain more information:<simplelist>
+ <member><ulink url="http://api.joomla.org">Joomla! API Reference</ulink></member>
+
+ <member><ulink url="https://developers.google.com/">Google Developers Homepage</ulink></member>
+ </simplelist></para>
+ </section>
+ </section>
+</section>

0 comments on commit fa52de8

Please sign in to comment.
Something went wrong with that request. Please try again.