0.0
No release in over 3 years
Low commit activity in last 3 years
Posting to Google Forms from your ruby scripts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 0.9
~> 1.10
 Project Readme

Google Forms Ruby Gem

When you need to post something to a Google Form from your ruby script.

How it works

I got tired of copypasting field names from Google Forms to my code and created a gem that gets the whole Google Form page using curb and grabs input names from it using Nokogiri.

Installation

Add to your Gemfile:

gem 'google_forms'

and run bundle, or just:

gem install google_forms

Usage

Assuming you have a form to fill with your script:

Example Google Form

Make sure your fields don't have any validations

Add the gem to your project:

require 'google_forms'

Pass a Google Form id or an url (yes, short url will work too):

form = GoogleForm.new('https://forms.gle/QvQbSm5Gxg7GNwBq9')

 => #<GoogleForm:12134640 @id=\"1FAIpQLScgwPtuN0aMJ6NLztq2kTZ4pdebxcrE_99Ax6I0fQtBwaT7fA\">

Get the list of input fields:

form.inputs

 => [#<GoogleFormInput:... @input_type="text", @label="id", @name="entry.462465405">, ...]

form.inputs.map(&:label)

 => ["id", "username", "first_name", "last_name"]

Fill in the inputs (using labels):

form.id = 12345
form.username = 'installero'
form.first_name = 'Vadim'
form.last_name = 'V'

And post the response:

form.post

Or do it all in one line:

form.post(id: 12345, username: 'installero', first_name: 'Vadim', last_name: 'V')

Yes, you can combine:

form.id = 12345
form.post(username: 'installero', first_name: 'Vadim', last_name: 'V')