Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple_google_drive

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple_google_drive

  • 0.5.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SimpleGoogleDrive

Build Status Code Climate Bitdeli Badge

A simple interface for Google Drive API

Installation

Add this line to your application's Gemfile:

gem 'simple_google_drive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_google_drive

Getting Started

You need to create a new object and then call its methods. Simple like that.

 oauth2_access_token = "YOUR ACCESS TOKEN"
 client = SimpleGoogleDrive.new(oauth2_access_token)
 client.about

Methods

Each method name was made to be compliant with Google Drive API reference.

https://developers.google.com/drive/v2/reference/

About

    client.about
    # => {"kind": "drive#about", ... }

Files methods

 optional_params = {:updateViewedDate => true}
 client.files_get(file_id, optional_params)

This method is only for metadata-only requests not to upload files.

 body = {:title => "A thesis about how awesome I am", :description => "No need!", }
 optional_params = { :convert => true, :ocr => true }
 client.files_insert(body, optional_params)

Supporting only: simple and multipart uploads for now.

Simple Upload Example

 file_object = File.open("/tmp/awesome.pdf")
 args = {:uploadType => 'media'}
 client.files_upload(file_object, args)

Multipart Upload Example

 file_object = File.open("/tmp/awesome.pdf")
 args = {:uploadType => 'multipart', :body_object => {:title => "A thesis about how awesome I am", :description => "Ok! It needs!" }}
 client.files_upload(file_object, args)
 body = {:title => "A thesis about how awesome I am", :description => "Ok! It needs!" }
 optional_params = { :convert => true, :ocr => true }
 client.files_patch(file_id, body, optional_params)
 body = {:title => "A thesis about how awesome I am (copy)", :description => "Ok! It needs!" }
 optional_params = { :convert => true, :ocr => true }
 client.files_copy(file_id, body, optional_params)
 client.files_delete(file_id)

The most important part of this method is the search parameters and you can find more at https://developers.google.com/drive/search-parameters

 optional_params = {:maxResults => 10, :q => "title = 'awesome'"}
 client.files_list(optional_params)
 client.files_touch(file_id)
 client.files_trash(file_id)
 client.files_untrash(file_id)
 client.files_watch(file_id)

Todo's

  • Implement authenticantion flow
  • Implementing more methods
  • Improve test suite

Contributing

  1. Fork it ( http://github.com/guivinicius/simple_google_drive/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 31 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc