class QuestionproRails::SurveyMeta

Attributes

email_groups_list[R]

@return [Array<Hash>] Email Groups List collected from the survey meta.

templates_list[R]

@return [Array<Hash>] Templates List collected from the survey meta.

Public Class Methods

new(attributes) click to toggle source
# File lib/questionpro_rails/survey_meta.rb, line 13
def initialize (attributes)
  @email_groups_list = attributes['emailGroups']
  @templates_list    = attributes['templates']
end

Public Instance Methods

email_groups() click to toggle source

Extract the Email Groups from the hashes stored inside email_groups_list attribute.

@return [Array<QuestionproRails::EmailGroup>] Email Groups.

# 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() click to toggle source

Extract the Templates from the hashes stored inside templates_list attribute.

@return [Array<QuestionproRails::Template>] Templates.

# 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