Class: QuestionproRails::SurveyResponse
- Inherits:
-
Object
- Object
- QuestionproRails::SurveyResponse
- Defined in:
- lib/questionpro_rails/survey_response.rb
Instance Attribute Summary collapse
-
#qp_response_set ⇒ Array<Hash>
readonly
Response Set collected from the survey response.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ SurveyResponse
constructor
A new instance of SurveyResponse.
-
#response_set ⇒ Array<QuestionproRails::ResponseSet>
Extract the Response Set from the hash stored inside qp_response_set attribute.
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_set ⇒ Array<Hash> (readonly)
Returns 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_set ⇒ Array<QuestionproRails::ResponseSet>
Extract the Response Set from the hash stored inside qp_response_set attribute.
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 |