Class: QuestionproRails::Survey
- Inherits:
-
Object
- Object
- QuestionproRails::Survey
- Defined in:
- lib/questionpro_rails/survey.rb
Instance Attribute Summary collapse
-
#has_scoring_logic ⇒ Object
readonly
Returns the value of attribute has_scoring_logic.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#numeric_title ⇒ Object
readonly
Returns the value of attribute numeric_title.
-
#qp_sections ⇒ Array<Hash>
readonly
Sections collected from the survey request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#subtitle ⇒ Object
readonly
Returns the value of attribute subtitle.
-
#thank_you_message ⇒ Object
readonly
Returns the value of attribute thank_you_message.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Survey
constructor
A new instance of Survey.
-
#sections ⇒ Array<QuestionproRails::Section>
Extract the Sections from the hashes stored inside qp_sections attribute.
Constructor Details
#initialize(attributes) ⇒ Survey
Returns a new instance of Survey.
12 13 14 15 16 17 18 19 20 21 22 |
# 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'] = attributes['thankYouMessage'] @has_scoring_logic = attributes['hasScoringLogic'] @numeric_title = attributes['numericTitle'] @status = attributes['status'] @qp_sections = attributes['sections'] end |
Instance Attribute Details
#has_scoring_logic ⇒ Object (readonly)
Returns the value of attribute has_scoring_logic.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def has_scoring_logic @has_scoring_logic end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def name @name end |
#numeric_title ⇒ Object (readonly)
Returns the value of attribute numeric_title.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def numeric_title @numeric_title end |
#qp_sections ⇒ Array<Hash> (readonly)
Returns Sections collected from the survey request.
10 11 12 |
# File 'lib/questionpro_rails/survey.rb', line 10 def qp_sections @qp_sections end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def status @status end |
#subtitle ⇒ Object (readonly)
Returns the value of attribute subtitle.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def subtitle @subtitle end |
#thank_you_message ⇒ Object (readonly)
Returns the value of attribute thank_you_message.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/questionpro_rails/survey.rb', line 6 def url @url end |
Instance Method Details
#sections ⇒ Array<QuestionproRails::Section>
Extract the Sections from the hashes stored inside qp_sections attribute.
28 29 30 31 32 33 34 35 36 37 38 |
# 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 |