class QuestionproRails::Survey

Attributes

has_scoring_logic[R]
id[R]
name[R]
numeric_title[R]
qp_sections[R]

@return [Array<Hash>] Sections collected from the survey request.

status[R]
subtitle[R]
thank_you_message[R]
url[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/questionpro_rails/survey.rb, line 12
def initialize (attributes)
  @id                = (attributes['id'] || attributes['surveyID']) 
  @name              = (attributes['title'] || attributes['surveyName'])
  @url               = (attributes['surveyURL'] || attributes['connectURL'])
  @subtitle          = attributes['subtitle']
  @thank_you_message = attributes['thankYouMessage']
  @has_scoring_logic = attributes['hasScoringLogic']
  @numeric_title     = attributes['numericTitle']
  @status            = attributes['status']
  @qp_sections       = attributes['sections']
end

Public Instance Methods

sections() click to toggle source

Extract the Sections from the hashes stored inside qp_sections attribute.

@return [Array<QuestionproRails::Section>] Sections.

# File lib/questionpro_rails/survey.rb, line 28
def sections
  extracted_sections = []

  unless self.qp_sections.nil?
    self.qp_sections.each do |section|   
      extracted_sections.push(Section.new(section))
    end           
  end

  return extracted_sections
end