Created
October 8, 2014 14:38
-
-
Save joemsak/da63f495928155a801a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "google_drive" | |
# Logs in. | |
# You can also use OAuth. See document of | |
# GoogleDrive.login_with_oauth for details. | |
session = GoogleDrive.login("username@gmail.com", "mypassword") | |
# Gets list of remote files. | |
for file in session.files | |
p file.title | |
end | |
# Uploads a local file. | |
session.upload_from_file("/path/to/hello.txt", "hello.txt", :convert => false) | |
# Downloads to a local file. | |
file = session.file_by_title("hello.txt") | |
file.download_to_file("/path/to/hello.txt") | |
# Updates content of the remote file. | |
file.update_from_file("/path/to/hello.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment