Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pengwynn/formstack
Ruby wrapper for the Formstack API
https://github.com/pengwynn/formstack
Last synced: 3 months ago
JSON representation
Ruby wrapper for the Formstack API
- Host: GitHub
- URL: https://github.com/pengwynn/formstack
- Owner: pengwynn
- License: mit
- Created: 2010-05-23T19:50:24.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2016-03-30T18:27:35.000Z (almost 9 years ago)
- Last Synced: 2024-09-16T13:48:55.572Z (4 months ago)
- Language: Ruby
- Homepage:
- Size: 181 KB
- Stars: 9
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# Formstack
Simple Ruby wrapper for the [Formstack](http://formstack.com) (née Formspring) API.
## Installation
sudo gem install formstack
## UsageYou'll need a Formstack [API key](https://www.formstack.com/admin/apiKey/main) with appropriate permissions.
require 'formstack'
client = Formstack::Client.new("your_api_key")
### Listing your formsforms = client.forms
### Getting details for a single formform = client.form(1234)
### Getting submission data for a formdata = client.data(1234, :page => 2)
### Submitting dataHere's where we apply some Ruby magic. The API requires you to know the IDs of your custom form fields (e.g. `field_123=blue`). You're more than welcome to use IDs for your hash keys if you like, but you don't have to:
# hash keys correspond to the value of the `name` key in `form.fields`
answers = {
:name => 'Wynn Netherland',
:rating => 5
}
# submit answers to form 1234 - field IDs are looked up on-the-fly
client.submit(1234, :data => answers)
### Editing data# hash keys correspond to the value of the `name` key in `form.fields`
answers = {
:name => 'Wynn Netherland',
:rating => 5
}
# edit answers for submission 10001
client.edit(10001, :data => answers)
### Deleting dataclient.delete(10001)
## TODO:
* Handle file uploads for submissions
* Intelligent permission handling for different API key access levels
## Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.### Copyright
Copyright (c) 2010 Wynn Netherland. See LICENSE for details.