[ruby][googledrive] Google DriveにアクセスするRubyライブラリを作りました
作りました、というか、google-spreadsheet-rubyにスプレッドシート以外のファイルをアップロード/ダウンロードする機能を加えて改名しました。
Google Drive Appを作るライブラリではありません。Google Driveにアクセスする2種類のライブラリの違いについてはこちら。
インストール:
$ sudo gem install google_drive
使用例:
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")
require "google_drive" GoogleSpreadsheet = GoogleDrive
するだけのライブラリになる予定です。