Class: Google::APIClient::FileStorage Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/google/api_client/auth/file_storage.rb

Overview

Deprecated.

Use Storage and FileStore instead

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileStorage

Returns a new instance of FileStorage.



34
35
36
37
38
# File 'lib/google/api_client/auth/file_storage.rb', line 34

def initialize(path)
  store = Google::APIClient::FileStore.new(path)
  @storage = Google::APIClient::Storage.new(store)
  @storage.authorize
end

Instance Attribute Details

#storageObject

Returns the value of attribute storage.



32
33
34
# File 'lib/google/api_client/auth/file_storage.rb', line 32

def storage
  @storage
end

Instance Method Details

#authorizationObject



44
45
46
# File 'lib/google/api_client/auth/file_storage.rb', line 44

def authorization
  storage.authorization
end

#load_credentialsObject



40
41
42
# File 'lib/google/api_client/auth/file_storage.rb', line 40

def load_credentials
  storage.authorize
end

#write_credentials(auth = nil) ⇒ Object

Write the credentials to the specified file.

Parameters:

  • authorization (Signet::OAuth2::Client)

    Optional authorization instance. If not provided, the authorization already associated with this instance will be written.



54
55
56
# File 'lib/google/api_client/auth/file_storage.rb', line 54

def write_credentials(auth=nil)
  storage.write_credentials(auth)
end