missinglink is a gem for interfacing with the SurveyMonkey API.
gem install missinglink
bundle exec rake missinglink:install:migrations
bundle exec rake db:migrate
Missinglink::Connection.credential_hash = { api_key: API_KEY, token: TOKEN }
Missinglink.poll_surveys
Missinglink::Survey.all.each do |survey|
Missinglink.fetch_respondents(survey)
end
Other methods:
-
survey.load_survey_details
to pull down question structure for a specific structure, if it has not been updated yet -
survey.load_respondents
to get the base respondent detail for a survey -
survey.load_response_details(respondents)
to pull down all of the answers given for any set of respondents to a survey -
survey_question.possible_responses
to list all response answers for a given question in the form of a hash, with the key as the text of the answer and the value as a representative survey response answer object -
survey_question.similar_response_answers(response_answer)
to find all answers that are similar to a given answer, based on the qustion type. for instance, a single text field type question will find all answers that have the same text, but a matrix will find those that have the same row and column value. -
survey_respondent_detail.response_to_question(question)
will return a plaintext response for a question, if it exists.
Contact Trey at [email protected] or find him on github.
This project rocks and uses MIT-LICENSE.