0.0
No commit activity in last 3 years
No release in over 3 years
Simple wrapper for the Typeform I/O
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Typeform

Typeform I/O client for Ruby.

Usage

Initialize Client

typeform_api_key = ENV['TYPEFORM_API_KEY']
client = Typeform::Client.new(typeform_api_key)

Get API information

If you want to make sure your authentication and connection to Typeform I/O works, call Typeform::Client#information.

client.information

The response contains information about the API. It is useful for testing or making sure you have access.

{
  "name": "Typeform I/O Build API",
  "description": "Build API for creating forms awesomely",
  "version": "v0.4",
  "documentation": "https://docs.typeform.io/",
  "support": "support@typeform.io",
  "time": "2015-05-26 17:55:23 +0000"
}

Create a typeform

Call Typeform::Client#create_form_from_file to create a new typeform.

file = File.open("example/example.json")
client.create_form_from_file(file)

You have parameters to set the title, webhook URL and of course, the fields. The form endpoint will also return you a hash of URLs that you can use to distribute your typeform or delete it.

{
  "id": "keEwsGeuC",
  "title": "My first typeform",
  "fields": [
    {
      "type": "short_text",
      "question": "What is your name?"
    }
  ],
  "links": [
    {
      "rel": "self",
      "href": "https://api.typeform.io/latest/forms/keEwsGeuC"
    },
    {
      "rel": "form_render",
      "href": "https://forms.typeform.io/to/keEwsGeuC"
    }
  ]
}

Show typeform

You can get the structure back of a typeform. It's useful if you want to allow your users to edit their typeform or you just want to get the URL of the typeform by leveraging the links.rel['form_render'].href link.

client.show_form(form_id)