0.0
No commit activity in last 3 years
No release in over 3 years
Authorize a Google account and upload files to its Drive.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 5.1.0, ~> 5.1
~> 0.49.1

Runtime

>= 2.1.0, ~> 2.1
>= 1.4.0, ~> 1.4
>= 2.0.2, ~> 2.0
 Project Readme

Googledriver 0.0.2

Authorize a Google account and upload files to its Drive.

Requirements

Before use, a secrets file must be downloaded by following the wizard here. Googledriver was developed using Ruby 2.3.1 and is untested on other versions. This gem has the following runtime dependencies which can be managed using bundler:

Install the gem using the following Bash command:

sudo gem install googledriver

Then add to your Ruby programs as needed:

require 'googledriver'

Example Method Usage

Creating an Uploader object:

uploader = Googledriver::Uploader.new('/home/usr/client_secret.json')

Creating an Authorizer object:

authorizer = Googledriver::Authorizer.new('/home/usr/client_secret.json')
# Note that the Uploader class creates an Authorizer object so there is no need
# to create both manually if you wish to perform an upload.

Uploading a filesystem to Google Drive:

uploader.upload_filesystem(directory: '/home/usr/file_sys', upload_dest: 'root')

Uploading a file to Google Drive:

uploader.upload_file('/home/usr/image.jpeg', 'image_name', location: 'root')
# Note that location can be a folder id if the desired location for the file
# is not root.

Update the name of a file in Google Drive:

uploader.update_file_metadata('0x123abc', 'name', 'new_name')
# Note that the second parameter is the metadata element to be updated so only
# certain strings are allowed.

Sharing a file with a user or group in Google Drive:

uploader.update_file_permission('0x123abc', 'sharewithme@gmail.com')

Example Program

require 'googledriver'

uploader = Googledriver::Uploader.new('/home/usr/client_secret.json')
uploader.upload_filesystem(directory: '/home/usr/file_sys', upload_dest: 'root')
uploader.archive_file_ids