#189 - Fix legacy file storage

This commit is contained in:
Steven Bazyl 2015-01-09 16:02:40 -08:00
parent 21cd5b27b1
commit 28adb02b60
2 changed files with 10 additions and 13 deletions

View File

@ -29,12 +29,10 @@ module Google
#
class FileStorage
attr_accessor :storage,
:path
attr_accessor :storage
def initialize(path)
@path = path
store = Google::APIClient::FileStore.new(@path)
store = Google::APIClient::FileStore.new(path)
@storage = Google::APIClient::Storage.new(store)
@storage.authorize
end
@ -54,8 +52,7 @@ module Google
# Optional authorization instance. If not provided, the authorization
# already associated with this instance will be written.
def write_credentials(auth=nil)
self.authorization = auth unless auth.nil?
storage.write_credentials(self.authorization)
storage.write_credentials(auth)
end
end
end

View File

@ -77,7 +77,7 @@ module Google
##
# Request authorization. Opens a browser and waits for response.
#
# @param [Google::APIClient::FileStorage] storage
# @param [Google::APIClient::Storage] storage
# Optional object that responds to :write_credentials, used to serialize
# the OAuth 2 credentials after completing the flow.
#