https://github.com/rubyhcm/google_api_upload_files
https://github.com/rubyhcm/google_api_upload_files
google-drive-api rails
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rubyhcm/google_api_upload_files
- Owner: rubyhcm
- Created: 2025-02-25T08:02:58.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-02-25T08:24:54.000Z (11 months ago)
- Last Synced: 2025-02-25T09:28:21.807Z (11 months ago)
- Topics: google-drive-api, rails
- Language: Ruby
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Gemfile
`gem "google-apis-drive_v3", "~> 0.58.0"`
#### Some changed files
```ruby
# app/controllers/files_controller.rb
# app/services/google_drive_service.rb
# app/views/files/_form.html.erb
# app/views/files/index.html.erb
# app/views/layouts/application.html.erb to add bootstrap and fontawesome
# app/views/shared/_messages.html.erb
# config/credentials/google_drive_credentials.json this is a file which we downloaded from google when create key
# config/routes.rb
```
#### Guide
- Create a Google Cloud Project
- Go to the Google Cloud Console.
- Click on "Select a project" and then "New Project."
- Enter a name for your project and click "Create."
- Enable Google Drive API
- In the Google Cloud Console, navigate to "APIs & Services" > "Library."
- Search for "Google Drive API" and click on it.
- Click the "Enable" button to activate the API for your project.
- Create a Service Account
- In the Google Cloud Console, navigate to "IAM & Admin" > "Service Accounts."
- Click "Create Service Account," provide a name, and click "Create."
- Assign the necessary roles (e.g., "Editor" or "Viewer") for Google Drive access.
- Generate a Key for the Service Account
- After creating the Service Account, click on it to open its details.
- Go to the "Keys" tab and click "Add Key" > "Create New Key."
- Choose JSON as the key type and download the key file.
#### Note
You can using `fast_upload_google_drive.rb` to upload/delete files