Class: BhtSurvey::QualtricsSurveysController

Inherits:
ApplicationController
  • Object
show all
Includes:
QualtricsInterface
Defined in:
app/controllers/bht_survey/qualtrics_surveys_controller.rb

Constant Summary collapse

EXCLUDELIST =
['IPAddress', 'Location', 'StartDate', 'ResponseID', 'ResponseSet',
'LocationAccuracy', 'LocationLatitude', 'LocationLongitude', 'RecipientLastName', 'RecipientFirstName',
'Status', 'Finished', 'RecipientEmail']

Instance Method Summary collapse

Methods included from QualtricsInterface

#get_api, #get_participant_link, #get_participant_state, #get_participant_states, #get_results, #get_workspace_key, #process_link_clicked_event

Instance Method Details

#indexObject



9
10
11
12
13
14
15
16
# File 'app/controllers/bht_survey/qualtrics_surveys_controller.rb', line 9

def index
  participant_id = params["participant_id"]
  survey_name = params["survey_name"]
  #process_link_clicked_event participant_id, survey_name
  result = get_participant_link participant_id, survey_name
  unique_link = result['unique_link']
  render json: {unique_link: unique_link}.to_json, status: 200
end

#resultsObject



18
19
20
21
22
23
24
# File 'app/controllers/bht_survey/qualtrics_surveys_controller.rb', line 18

def results
  participant_id = params["participant_id"]
  survey_name = params["survey_name"]
  result = get_results participant_id, survey_name
  display_answers = result['answers'].except(*EXCLUDELIST)
  render json: display_answers.to_json, status: 200
end