JotForm API - RubyGem wrapper for JotForm's ruby client.
Via RubyGems:
$ gem install jotform-api
Via Bundler:
Add the following to your Gemfile:
gem 'jotform-api'
Then run:
$ bundle install
This wrapper is the dumbest thing that can work. We're using it to fetch the questions for forms over the API, but if you try to use it for anything else, it will almost definitely break.
The gem is structured so that all code is inside the JotForm namespace. To avoid having to use JotForm::JotForm all over the place, use the API class, which wraps the JotForm class and memoizes the connection so it can be used internally.
This will only work if you're interacting with a single API key/connection.
The gem also includes a very basic rendering helper, designed to output a form ready to submit to JotForm. This uses HAML to build the form, because that's what we're using. Not all field types are supported yet, and you don't get anything fancy like validations, etc.
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
require 'JotForm'
jotform = JotForm::API.new("APIKey")
forms = jotform.getForms()
forms.each do |form|
puts form["title"]
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.