Move API calls to own function

In preparation for switch to Admin SDK API, move all API calls to their
own functions. This will make it easier to code
the API change without changing program logic.

This is related to trevore/galias#4
Merge pull request #6 from cjs/refactor_abstract_api_calls

Move API calls to own function