Represents cached OAuth 2 tokens stored on local disk in a JSON serialized file. Meant to resemble the serialized format google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.file.Storage-class.html
@return [Object] Storage object.
Write the credentials to the specified store.
@params [Signet::OAuth2::Client] authorization
Optional authorization instance. If not provided, the authorization already associated with this instance will be written.
# File lib/google/api_client/auth/storage.rb, line 49 def write_credentials(authorization=nil) @authorization = authorization if authorization if @authorization.respond_to?(:refresh_token) && @authorization.refresh_token store.write_credentials(credentials_hash) end end
@return [Hash] with credentials
# File lib/google/api_client/auth/storage.rb, line 87 def credentials_hash { :access_token => authorization.access_token, :authorization_uri => AUTHORIZATION_URI, :client_id => authorization.client_id, :client_secret => authorization.client_secret, :expires_in => authorization.expires_in, :refresh_token => authorization.refresh_token, :token_credential_uri => TOKEN_CREDENTIAL_URI, :issued_at => authorization.issued_at.to_i } end
Attempt to read in credentials from the specified store.
# File lib/google/api_client/auth/storage.rb, line 81 def load_credentials store.load_credentials end