Refactor the getSecret() method to use several private methods.

This change cleans up the getSecret() method and moves the begin/rescue
blocks into individual methods for each part of the process:
  - getting from the short term cache
  - getting from the API
  - getting from the long term cache

Change-Id: Icf928733771aeff8d5a8c955e73d3a224d7dfb95
Merge "Refactor the getSecret() method to use several private methods."