ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

Google Apps & Ruby/Rails

release
Date: 2009-11-17
Tags: api google ruby integration

At MITA, we used Google Apps for email, online documents, spreadsheets, forms, chat, and more.
I've been weaving Applications together in an Intranet, using Ruby & Rails.
Ruby is a pleasure to work with. It is a logical, flexible, and powerful object-oriented scripting-type language. The "Staff Listing" on the Intranet list the 50+ employees in the organization, and the data is pulled from PowerSchool, the school's Student Information System (SIS) [where all Employees are centrally managed anyway].

Using Ruby and Google's API, I've put together the following pages:

  • Index
  • Login

Using a webform, submit Google login information (username and password) to https://www.google.com/accounts/ClientLogin , which returns the "token":

SID=DQAAAIUAAAAfSngN...
LSID=DQAAAIcAAAAinnV...
Auth=DQAAAIcAAAAinnV...
  • Reports
    The "Reports" page uses the SID from the token, and submits a request to google.com/hosted/services/v1.0/reports/ReportingData. Using Google's API, I can grab * accounts

  • activity

  • disk_space

  • email_clients

  • quotalimitaccounts

  • summary

  • suspendedaccounts (described <a href="http://code.google.com/apis/apps/reporting/googleappsreportingapi.html">here)

    @token = SID @domain = your Google Apps domain name (this assumes you are using Google Apps for your domain)
    @date = "2009-11-14"

    This XML String will be posted to the URL below

    xml_req =< Report #{@token} @domain @date daily accounts EOF

    This actually posts the Request

    http = Net::HTTP.new('www.google.com', 443) http.usessl = true req = http.post('/hosted/services/v1.0/reports/ReportingData', xmlreq)

I've also touched the surface pulling feeds from the domain, using google.com/a/feeds/domain_name - this is something to explore a bit more.

By Ryan · © 2009–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.

Leave a tip

Tips go directly to a Bitcoin SV address I control — peer to peer, no platform in between. A few thousand satoshis is a fraction of a cent; it's the gesture that counts.

From any BSV wallet

Scan the QR code with your wallet's camera, or copy the address.

177DwUfSTW8RkFBJzYYcgr1YB8ngbhTYAc

With HandCash or any paymail wallet

Paymail is an email-style address for Bitcoin wallets. Send any amount to afomi@handcash.io

First time using Bitcoin? Yours Wallet is an open-source browser extension wallet, and HandCash is an easy mobile wallet — either takes a minute to set up.

Prefer regular money? Support via OpenCollective.