Note: Be sure to locally cache a copy of the APIs you're using. Doing so saves a round-trip to Google servers on every run. You can do this by serializing the returned Google::APIClient::API object to an appropriate location. Check the sample code for more details.
For serializing Objects I believe it's as simple as Marshal. I've looked at the sample code they've provided but I don't see how this is done. In a scalable Rails server would it be best to somehow have the API loaded when the Rails server starts and have it be usable by countless clients from the Rails system memory? I believe to marshal and unmarshal it into the DB would be a bad idea.
I need to write it in such a way that the discovered API request doesn't run for each user instance and call. I'm thinking an initializer would be nice. I've search for a Rails configuration for google-api-ruby-client. But there doesn't seem to be a site-wide model for this. Each example loads and calls everything each execution.
The best case answer would be an initializer that allows me to load the API once on server starts and to be able to call it from many different user credentials which are already saved.
Here's one such API discovery I'll be using:
Google::APIClient.new(
application_name: "My App Name", application_version: "1.0.0"
).discovered_api('plusDomains')