class QuestionproRails::ResponseSet

Attributes

qp_values[R]

@return [Array<Hash>] Answers collected from the survey response.

question_code[R]
question_description[R]
question_id[R]
question_text[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/questionpro_rails/response_set.rb, line 11
def initialize (attributes)
  @question_code        = attributes['questionCode']
  @question_description = attributes['questionDescription']
  @question_id          = attributes['questionID']
  @question_text        = attributes['questionText']
  @qp_values            = attributes['values']      
end

Public Instance Methods

answers() click to toggle source

Extract the Answers from the hashes stored inside qp_values attribute.

@return [Array<QuestionproRails::ResponseAnswer>] Response Answers.

# File lib/questionpro_rails/response_set.rb, line 23
def answers
  extracted_answers = []

  unless self.qp_values.nil?
    self.qp_values.each do |answer|   
      extracted_answers.push(ResponseAnswer.new(answer))
    end           
  end

  return extracted_answers      
end