google/google-api-ruby-client — pull request #117 by dougforpres (2014-03-13 22:00:27+00:00)
Title: Auth retry

Related to #116
This patch will catch 401 errors and attempt to re-auth then re-try the operation.
It works inside the scope of the existing Retriable code.

If retries == 0 (current default) it will attempt refresh of auth + a retry IIF the (new) member 'expired_auth_retry' is set to true (the default)

If retries > 0 it will attempt refresh of auth + retry IIF this is the first time thru. (this doesn't count against main retries counter as a 401 is typically recoverable)

If retries == 0 and the 'expired_auth_retry' is false, the re-auth won't be attempted, and the 401 will fall thru to the caller.

Feedback welcome.
I tried getting it all working in a single retriable, but the "sometimes retry" stuff associated with retry count of 0 was problematic.

Doug