Ruby on Rails Private Link Sharing: Google Docs Style

Ruby on Rails private link sharing: Google Docs Style

I would have a separate controller that uses a hash value to reference the event.

Something simple like the created_at + user_id hashed to create a unique reference.

You could also simply skip the check on a certain action but I would much prefer the first solution .

Access Google Drive API v3 with Ruby on Rails

You need OAuth 2.0 to authorize requests on the Drive API as described on the documentation. In that link, you can find: «All requests to the Drive API must be authorized by an authenticated user».

To complete that authorization process, you should follow the instructions on the Drive API Ruby Quickstart linked on your question. Generating and saving a credentials.json for later use is the normal approach in this situation. Here you can read about using OAuth 2.0 over different scenarios.

I hope to have cleared your doubts on this topic, but feel free to ask further questions.

How to store private pictures and videos in Ruby on Rails

I would have Paperclip use S3 on the back-end, set uploaded files to private, and then use "Query String Request Authentication Alternative" to generate the URLs for my image tags.

http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTAuthentication.html

How to download a file via the Google Drive API?

Stated in Download Files

Depending on the type of download you'd like to perform — a file, a Google Document, or a content link — you'll use one of the following URLs:

  • Download a file — files.get with alt=media file resource
  • Download and export a Google Doc — files.export
  • Link a user to a file — webContentLink from the file resource

Downloading the file requires the user to have at least read access. Additionally, your app must be authorized with a scope that allows reading of file content.

You may go through the documentation for more information and examples.

How to upload a file to a shared drive with Google API Drive v3 ruby gem

I believe your goal is as follows.

  • You want to upload a file to the specific folder in the shared Drive using Drive API v3.
  • You want to achieve this using googleaspif ro ruby.

In this case, how about the following modification?

Modified script:

google_file = Google::Apis::DriveV3::File.new(name: 'test.txt', parents: ['###'])
drive = Google::Apis::DriveV3::DriveService.new
drive.create_file(google_file, upload_source: "text.txt", supports_team_drives: true)
  • Here, please set the folder ID to ### of parents: ['###']. If you want to upload the file to the root folder of the shared Drive, please set the drive ID to ### of parents: ['###'].

Note:

  • This modification suppoges that your drive can be used for uploading the file to the shared Drive. Please be careful about this.

References:

  • Files: create
  • Class: Google::Apis::DriveV3::DriveService


Related Topics



Leave a reply



Submit