The SurveyGizmo Ruby Gem
A Ruby wrapper for the SurveyGizmo REST API
Installation
gem install surveygizmo
Usage
# Configure your Surveygizmo client
Surveygizmo.configure do |config|
config.username = YOUR_USERNAME
config.password = YOUR_PASSWORD
end# Return a list of all Surveys
Surveygizmo.surveys# Return a specific Survey
Surveygizmo.survey(id)See the Documentation for the full list
Filtering
You can filter any request by passing a hash to the filter option.
# Only show survey responses that have been made after 1 January 2012
Surveygizmo.survey_responses(survey_id, filter: { field: "datesubmitted", operator: ">=", value: "2012-01-01"})You can add multiple filters by passing an array of hashes.
# Show responses made in January 2012
Surveygizmo.survey_responses(survey_id, filter: [{ field: "datesubmitted", operator: ">=", value: "2012-01-01"}, {field "datesubmitted", operator: "<=", value: "2012-01-31"])Accessing meta data of the requests
You can access the result_ok?, total_count, page, total_pages and results_per_page metadata.
# Count the survey responses, but don't fetch them.
Surveygizmo.survey_questions(survey_id, resultsperpage: 0).total_count To Do List
This gem is very young, and not all endpoints have been implemented. Here’s a brief overview of the progress so far (italics denotes lack of implementation):
- Account
- Show
- Account User
- Index
- Show
- Create
- Update
- Delete
- Contact
- Index
- Show
- Create
- Update
- Delete
- Survey
- Index
- Show
- Create
- Update
- Delete
- Survey Campaign
- Index
- Show
- Create
- Update
- Delete
- Survey Response
- Index
- Show
- Create
- Update
- Delete
- Survey Option
- Survey Question
- Survey Page
- Survey Statistics
- Email Message
Thanks
This gem is heavily inspired by the Twitter gem and John Nunemaker’s hard work.
Copyright
Copyright © 2011-2012 Bobby Uhlenbrock. See LICENSE for details.