Class: QuestionproRails::SurveyResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/questionpro_rails/survey_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ SurveyResponse

Returns a new instance of SurveyResponse.



13
14
15
16
17
18
19
20
21
22
23
24
25
# 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

Instance Attribute Details

#qp_response_setArray<Hash> (readonly)

Returns Response Set collected from the survey response.

Returns:

  • (Array<Hash>)

    Response Set collected from the survey response.



11
12
13
# File 'lib/questionpro_rails/survey_response.rb', line 11

def qp_response_set
  @qp_response_set
end

Instance Method Details

#response_setArray<QuestionproRails::ResponseSet>

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

Returns:



31
32
33
34
35
36
37
38
39
40
41
# 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