Class: Surveymonkey::Survey

Inherits:
Object
  • Object
show all
Defined in:
lib/surveymonkey_api/survey.rb

Overview

Survey

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Survey

Returns a new instance of Survey.



6
7
8
# File 'lib/surveymonkey_api/survey.rb', line 6

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/surveymonkey_api/survey.rb', line 4

def id
  @id
end

Instance Method Details

#details(options = {}) ⇒ Object



10
11
12
# File 'lib/surveymonkey_api/survey.rb', line 10

def details(options = {})
  @details ||= client.survey_details(id, options)
end

#raw_responses(options = {}) ⇒ Object



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

def raw_responses(options = {})
  client.survey_responses(id, options)
end

#responses(options = {}) ⇒ Object



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

def responses(options = {})
  @responses ||= client.survey_responses(id, options)['data'].each_with_object([]) do |response, arr|
    arr << Surveymonkey::Response.new(id, response['id'])
  end
end