class Google::APIClient::Storage
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
@deprecated Use google-auth-library-ruby instead
Constants
- AUTHORIZATION_URI
- TOKEN_CREDENTIAL_URI
Attributes
@return [Object] Storage
object.
Public Class Methods
Source
# File lib/google/api_client/auth/storage.rb, line 41 def initialize(store) @store= store @authorization = nil end
Initializes the Storage
object.
@param [Object] store
Storage object
Public Instance Methods
Source
# File lib/google/api_client/auth/storage.rb, line 52 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
Write the credentials to the specified store.
@param [Signet::OAuth2::Client] authorization
Optional authorization instance. If not provided, the authorization already associated with this instance will be written.
Private Instance Methods
Source
# File lib/google/api_client/auth/storage.rb, line 90 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
@return [Hash] with credentials
Source
# File lib/google/api_client/auth/storage.rb, line 84 def load_credentials store.load_credentials end
Attempt to read in credentials from the specified store.