Class: Surveymonkey::Response
- Inherits:
-
Object
- Object
- Surveymonkey::Response
- Extended by:
- Forwardable
- Defined in:
- lib/surveymonkey_api/response.rb
Overview
Response
Defined Under Namespace
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#survey_id ⇒ Object
readonly
Returns the value of attribute survey_id.
-
#survey_structure ⇒ Object
readonly
Returns the value of attribute survey_structure.
Instance Method Summary collapse
-
#initialize(survey_id, id) ⇒ Response
constructor
A new instance of Response.
- #pages(options = {}) ⇒ Object
- #raw_details(options = {}) ⇒ Object
Constructor Details
#initialize(survey_id, id) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 |
# File 'lib/surveymonkey_api/response.rb', line 7 def initialize(survey_id, id) @survey_id = survey_id @id = id @survey_structure = Surveymonkey::Survey.new(survey_id) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/surveymonkey_api/response.rb', line 5 def id @id end |
#survey_id ⇒ Object (readonly)
Returns the value of attribute survey_id.
5 6 7 |
# File 'lib/surveymonkey_api/response.rb', line 5 def survey_id @survey_id end |
#survey_structure ⇒ Object (readonly)
Returns the value of attribute survey_structure.
5 6 7 |
# File 'lib/surveymonkey_api/response.rb', line 5 def survey_structure @survey_structure end |
Instance Method Details
#pages(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/surveymonkey_api/response.rb', line 17 def pages( = {}) @pages ||= client.survey_response(survey_id, id, )['pages'].each_with_object([]) do |page, arr| if !page['questions'].empty? page_structure = details['pages'].detect{|p| p['id'] == page['id']} arr << Surveymonkey::Response::Page.new(page, page_structure) end end end |
#raw_details(options = {}) ⇒ Object
13 14 15 |
# File 'lib/surveymonkey_api/response.rb', line 13 def raw_details( = {}) client.survey_response(survey_id, id, ) end |