Project

easy-drive

0.0
No commit activity in last 3 years
No release in over 3 years
I just want to copy files on google drive.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.3

Runtime

 Project Readme

EasyDrive

I just want to copy files on google drive! (^^)

Installation

Add EasyDrive to your Gemfile.

gem 'easy_drive'

Initial Setup

  1. You need to enable the Drive API for your app and download client_secrets.json to your project root directory.

    You can do this in your app's API project in the Google APIs Console.

    See further information on google-api-ruby-client-samples

  2. Call setup, and both easy_drive-oauth2.json and easy_drive-v2.cache are created in project root directory.

    client = EasyDrive::Client.new
    client.setup # generate above 2 files.
    

Usage

client = EasyDrive::Client.new
client.copy(source_file_id, dest_folder_id, {title: 'new file name'})

That's all. Feel free to copy! (^^)

Advanced Usage

EasyDrive implements other Google Drive APIs.

Gets a file's metadata by ID.

client.get(file_id)

Insert(Upload) a new file.

client.insert('/etc/hello.txt', folder_id, {title: 'This is a new file.'})

Lists the user's all files.

client.list

Search files.

client.list({title: 'TITLE TEXT for searching'})

Search files in a specific folder.

client.list({title: 'TITLE TEXT for searching', folder_id: 'FOLDER_ID'})

EasyDrive is a wrapper of google-api-ruby-client.
So, you can call methods of google-api-ruby-client directly.

easy_drive_client = EasyDrive::Client.new
result = easy_drive_client.client.execute(
  :api_method => easy_drive_client.drive.files.get,
  :parameters => {
    'fileId' => 'file_id',
    'alt' => 'json'
  }
)