Class: QuestionproRails::SurveyMeta
- Inherits:
-
Object
- Object
- QuestionproRails::SurveyMeta
- Defined in:
- lib/questionpro_rails/survey_meta.rb
Instance Attribute Summary collapse
-
#email_groups_list ⇒ Array<Hash>
readonly
Email Groups List collected from the survey meta.
-
#templates_list ⇒ Array<Hash>
readonly
Templates List collected from the survey meta.
Instance Method Summary collapse
-
#email_groups ⇒ Array<QuestionproRails::EmailGroup>
Extract the Email Groups from the hashes stored inside email_groups_list attribute.
-
#initialize(attributes) ⇒ SurveyMeta
constructor
A new instance of SurveyMeta.
-
#templates ⇒ Array<QuestionproRails::Template>
Extract the Templates from the hashes stored inside templates_list attribute.
Constructor Details
#initialize(attributes) ⇒ SurveyMeta
Returns a new instance of SurveyMeta.
13 14 15 16 |
# File 'lib/questionpro_rails/survey_meta.rb', line 13 def initialize (attributes) @email_groups_list = attributes['emailGroups'] @templates_list = attributes['templates'] end |
Instance Attribute Details
#email_groups_list ⇒ Array<Hash> (readonly)
Returns Email Groups List collected from the survey meta.
8 9 10 |
# File 'lib/questionpro_rails/survey_meta.rb', line 8 def email_groups_list @email_groups_list end |
#templates_list ⇒ Array<Hash> (readonly)
Returns Templates List collected from the survey meta.
11 12 13 |
# File 'lib/questionpro_rails/survey_meta.rb', line 11 def templates_list @templates_list end |
Instance Method Details
#email_groups ⇒ Array<QuestionproRails::EmailGroup>
Extract the Email Groups from the hashes stored inside email_groups_list attribute.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/questionpro_rails/survey_meta.rb', line 22 def email_groups extracted_groups = [] unless self.email_groups_list.nil? self.email_groups_list.each do |email_group| extracted_groups.push(EmailGroup.new(email_group)) end end return extracted_groups end |
#templates ⇒ Array<QuestionproRails::Template>
Extract the Templates from the hashes stored inside templates_list attribute.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/questionpro_rails/survey_meta.rb', line 38 def templates extracted_templates = [] unless self.templates_list.nil? self.templates_list.each do |template| extracted_templates.push(Template.new(template)) end end return extracted_templates end |