class QuestionproRails::Section

Attributes

code[R]
dynamic_explode_text[R]
exact_min_answers[R]
has_page_break[R]
id[R]
left_anchor[R]
max_answers[R]
min_answers[R]
mobile_friendly[R]
num_tasks[R]
orientation[R]
qp_questions[R]

@return [Array<Hash>] Questions collected inside the section.

random[R]
random_section[R]
required[R]
right_anchor[R]
subtype[R]
title[R]
type[R]
video[R]
video_type[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/questionpro_rails/section.rb, line 15
          def initialize(attributes)
@id                   = attributes['sectionID']
@title                                                            = attributes['title']
                  @num_tasks            = attributes['numTasks']
                  @exact_min_answers    = attributes['exactMinAnswers']
                  @orientation          = attributes['orientation']
                  @code                 = attributes['code']
                  @video_type           = attributes['videoType']
                  @max_answers          = attributes['maxAnswers']                     
                  @dynamic_explode_text = attributes['dynamicExplodeText']                     
                  @video                = attributes['video']
                  @type                 = attributes['type']
                  @min_answers          = attributes['minAnswers']
                  @required             = attributes['required']
                  @has_page_break       = attributes['hasPageBreak']
                  @random               = attributes['random']
                  @random_section       = attributes['randomSection']
                  @subtype              = attributes['subtype']
                  @mobile_friendly      = attributes['mobileFriendly'] 
                  @qp_questions         = attributes['questions']      
                  @right_anchor                                        = attributes['rightAnchor']
                  @left_anchor                           = attributes['leftAnchor']                 
          end

Public Instance Methods

questions() click to toggle source

Extract the Questions from the hashes stored inside qp_questions attribute.

@return [Array<QuestionproRails::Question>] Questions.

# File lib/questionpro_rails/section.rb, line 43
          def questions
extracted_questions = []

unless self.qp_questions.nil?
  self.qp_questions.each do |question|   
    extracted_questions.push(Question.new(question))
  end           
end

return extracted_questions                        
          end