Connect your ruby app with google drive.

Episode #43

by Sebastian Wilgosz

Picture of the author

In the [[38-hanami-mastery-app|episode 38]], we used a high-level application diagram to visualize the needs our hanami mastery application will help us to solve.

In this episode, we'll go to the next level, and I'll start taking care of one of the most annoying steps I have during the episode creation process, which is thumbnail preparation.

My process for preparing thumbnails is this:

  1. Create Thumbnail in Google Drive - When the video is starting to be produced, the thumbnail is chosen, prepared, and downloaded to the episode's google drive folder.
  2. Prepare Versions - We use this thumbnail for youtube videos, but also we save it in the repository and generate image versions out of it.
  3. Push all versions to GitHub - at the end, all the images are committed to the episode's branch and pushed to GitHub, waiting for publication.

Google Drive Integration schemaGoogle Drive Integration schema

I want to completely delegate or automate the work choosing and adjusting thumbnails, and I don't want people to be forced learning how to work with GitHub repositories and how to commit files.

This is the reason why I'll keep uploading thumbnails to drive following a simple file name convention and automate the rest.

First step - google drive integration

As you may expect, to work with thumbnails, I need to download my file from google.

Later we'll download it once the episode gets scheduled using some sort of sidekiq observer or event listener.

Let's start with the google drive integration then.

Enable API and download credentials

To start working with google API, I visited their Python tutorial for the language-agnostic part.

First you need to enable it on your account using google UI, and then setup credentials.

Then make sure you share your drive with the service account email.

You'll need to create a new access Key and download as a json file, saved in the root directory of our project.

Once you have it, we can implement the connection.

Subscribe to Hanami Mastery PRO

This is only a preview of the episode. Subscribe to Hanami Mastery PRO to see the full video, and access several other premium resources. Thanks for watching, and see you in the next one!


That's all for today, thank you for watching, and see you in the next episode!

Do you know great Ruby gems?

Add your suggestion to our discussion panel!

I'll gladly cover them in the future episodes! Thank you!

Suggest topicTweet #suggestion

May also interest you...

#45 Github integration with HanamiPRO

If you're a developer, you know GitHub. And if you don't know Hanami, you definitely should. In this episode, I'll show you how to make them both to know each other.

Showing flash messages in Hanami is trivial, and it is even shown in the official guides. In this episode though, we make this future-proof, testable, and maintainable for a future growth of your application.

Probably any web app nowadays requires font icons to be loaded this or other way. In this episode, I'm showing the integration of Font Awesome icons in Hanami 2 applications.

This episode is a special release, when Seb interviews Tim Riley and Luca Guidi from the Hanami Core Team, asking them questions collected from the community! This way we enjoy reaching our important milestone of releasing 50th Hanami Mastery episode!

Coffee buy button
Trusted & Supported by

1 / 2
Open Hanami Jobs

We use cookies to improve your experience on our site. To find out more, read our privacy policy.