class QuestionproRails::SurveyResponse

Attributes

country[R]
duplicate[R]
external_reference[R]
id[R]
ip_address[R]
original_object[R]
qp_response_set[R]

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

region[R]
response_status[R]
time_taken[R]
timestamp[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/questionpro_rails/survey_response.rb, line 13
def initialize (attributes)
  @id                 = attributes['id']
  @country            = attributes['country']
  @duplicate          = attributes['duplicate']
  @external_reference = attributes['externalReference']
  @ip_address         = attributes['ipAddress']
  @region             = attributes['region']
  @qp_response_set    = attributes['responseSet']
  @response_status    = attributes['responseStatus']
  @time_taken         = attributes['timeTaken']
  @timestamp          = attributes['timestamp']
  @original_object    = attributes
end

Public Instance Methods

response_set() click to toggle source

Extract the Response Set from the hash stored inside qp_response_set attribute.

@return [Array<QuestionproRails::ResponseSet>] Response Sets.

# File lib/questionpro_rails/survey_response.rb, line 31
def response_set
  extracted_sets = []

  unless self.qp_response_set.nil?
    self.qp_response_set.each do |set|   
      extracted_sets.push(ResponseSet.new(set))
    end           
  end

  return extracted_sets
end