Module: Surveymonkey::Client::Survey

Included in:
Surveymonkey::Client
Defined in:
lib/surveymonkey_api/client/survey.rb

Overview

Survey endpoints

Instance Method Summary collapse

Instance Method Details

#all_survey_responses(survey_id, options = {}) ⇒ Object

Return all survey responses



38
39
40
41
42
43
44
45
46
47
# File 'lib/surveymonkey_api/client/survey.rb', line 38

def all_survey_responses(survey_id, options = {})
  response = self.class.get("/surveys/#{survey_id}/responses/bulk", { query: options })
  surveys = []
  surveys << if response['total'] > response['per_page']
              get_all_pages(response['links'])
            else
              response['data']
            end
  surveys.flatten
end

#survey_details(survey_id, options = {}) ⇒ Object

Return survey details (survey structure)



25
26
27
28
# File 'lib/surveymonkey_api/client/survey.rb', line 25

def survey_details(survey_id, options = {})
  response = self.class.get("/surveys/#{survey_id}/details", { query: options })
  response.parsed_response
end

#survey_folder(folder_id, options = {}) ⇒ Object

Return surveys folder



19
20
21
22
# File 'lib/surveymonkey_api/client/survey.rb', line 19

def survey_folder(folder_id, options = {})
  response = self.class.get("/survey_folders/#{folder_id}", { query: options })
  response.parsed_response
end

#survey_folders(options = {}) ⇒ Object

Return all survey folders



13
14
15
16
# File 'lib/surveymonkey_api/client/survey.rb', line 13

def survey_folders(options = {})
  response = self.class.get("/survey_folders", { query: options })
  response.parsed_response
end

#survey_response(survey_id, response_id, options = {}) ⇒ Object

Return survey response



50
51
52
53
# File 'lib/surveymonkey_api/client/survey.rb', line 50

def survey_response(survey_id, response_id, options = {})
  response = self.class.get("/surveys/#{survey_id}/responses/#{response_id}/details", { query: options })
  response.parsed_response
end

#survey_responses(survey_id, options = {}) ⇒ Object

Return all survey responses paginated



31
32
33
34
# File 'lib/surveymonkey_api/client/survey.rb', line 31

def survey_responses(survey_id, options = {})
  response = self.class.get("/surveys/#{survey_id}/responses/bulk", { query: options })
  response.parsed_response
end

#surveys(options = {}) ⇒ Object

Return all surveys



7
8
9
10
# File 'lib/surveymonkey_api/client/survey.rb', line 7

def surveys(options = {})
  response = self.class.get('/surveys', { query: options })
  response.parsed_response
end