JotForm API - Ruby Client
Install via git clone:
$ git clone git://github.com/jotform/jotform-api-ruby.git $ cd jotform-api-ruby
You can find the docs for the API of this client at http://api.jotform.com/docs/
JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.
Print all forms of the user
#!/usr/bin/env ruby require_relative 'JotForm' jotform = JotForm.new("APIKey") forms = jotform.getForms() forms.each do |form| puts form["title"] end
Get latest submissions of the user
#!/usr/bin/env ruby require_relative 'JotForm' jotform = JotForm.new("APIKey") submissions = jotform.getSubmissions() submissions.each do |submission| puts submission["created_at"] + " " submission["answers"].each do | answer| puts "\t" + answer.join(" ") end end
First the JotForm class is included from the jotform-api-ruby/JotForm.rb file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.