class Google::APIClient::FileStore
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
Attributes
Public Class Methods
Source
# File lib/google/api_client/auth/storages/file_store.rb, line 34 def initialize(path) @path= path end
Initializes the FileStorage object.
@param [String] path
Path to the credentials file.
Public Instance Methods
Source
# File lib/google/api_client/auth/storages/file_store.rb, line 40 def load_credentials open(path, 'r') { |f| JSON.parse(f.read) } rescue nil end
Attempt to read in credentials from the specified file.
Source
# File lib/google/api_client/auth/storages/file_store.rb, line 50 def write_credentials(credentials_hash) open(self.path, 'w+') do |f| f.write(credentials_hash.to_json) end end
Write the credentials to the specified file.
@param [Hash] credentials_hash