Class: Surveymonkey::Response::Page
- Inherits:
-
Object
- Object
- Surveymonkey::Response::Page
- Defined in:
- lib/surveymonkey_api/response/page.rb
Overview
Response Page
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#page_structure ⇒ Object
readonly
Returns the value of attribute page_structure.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
-
#initialize(raw_data, page_structure) ⇒ Page
constructor
A new instance of Page.
- #questions ⇒ Object
-
#title ⇒ Object
Match page title.
Constructor Details
#initialize(raw_data, page_structure) ⇒ Page
Returns a new instance of Page.
6 7 8 9 10 |
# File 'lib/surveymonkey_api/response/page.rb', line 6 def initialize(raw_data, page_structure) @raw_data = raw_data @id = raw_data['id'] @page_structure = page_structure end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/surveymonkey_api/response/page.rb', line 4 def id @id end |
#page_structure ⇒ Object (readonly)
Returns the value of attribute page_structure.
4 5 6 |
# File 'lib/surveymonkey_api/response/page.rb', line 4 def page_structure @page_structure end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
4 5 6 |
# File 'lib/surveymonkey_api/response/page.rb', line 4 def raw_data @raw_data end |
Instance Method Details
#questions ⇒ Object
17 18 19 20 21 22 |
# File 'lib/surveymonkey_api/response/page.rb', line 17 def questions @questions ||= raw_data['questions'].each_with_object([]) do |question, arr| question_structure = page_structure['questions'].detect { |q| q['id'] == question['id'] } arr << Surveymonkey::Response::Question.new(question, question_structure) end end |
#title ⇒ Object
Match page title
13 14 15 |
# File 'lib/surveymonkey_api/response/page.rb', line 13 def title @title ||= page_structure['title'] end |