Class: QuestionproRails::EmailList

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ EmailList

Returns a new instance of EmailList.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/questionpro_rails/email_list.rb', line 15

def initialize (attributes)      
  @survey_id           = attributes['surveyID']
  @email_group_id      = attributes['emailGroupID']
  @name                = attributes['name']      
  @qp_emails           = attributes['email']
  @qp_statistics       = attributes['statistics']
  @unsubscribed        = attributes['unsubscribed']
  @total               = attributes['total']
  @active              = attributes['active']
  @pendin_verification = attributes['pendinVerification']
  @bounced             = attributes['bounced']
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def active
  @active
end

#bouncedObject (readonly)

Returns the value of attribute bounced.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def bounced
  @bounced
end

#email_group_idObject (readonly)

Returns the value of attribute email_group_id.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def email_group_id
  @email_group_id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def name
  @name
end

#pendin_verificationObject (readonly)

Returns the value of attribute pendin_verification.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def pendin_verification
  @pendin_verification
end

#qp_emailsArray<String> (readonly)

Returns Emails.

Returns:

  • (Array<String>)

    Emails.



10
11
12
# File 'lib/questionpro_rails/email_list.rb', line 10

def qp_emails
  @qp_emails
end

#qp_statisticsHash (readonly)

Returns Email list statistics.

Returns:

  • (Hash)

    Email list statistics.



13
14
15
# File 'lib/questionpro_rails/email_list.rb', line 13

def qp_statistics
  @qp_statistics
end

#survey_idObject (readonly)

Returns the value of attribute survey_id.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def survey_id
  @survey_id
end

#totalObject (readonly)

Returns the value of attribute total.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def total
  @total
end

#unsubscribedObject (readonly)

Returns the value of attribute unsubscribed.



6
7
8
# File 'lib/questionpro_rails/email_list.rb', line 6

def unsubscribed
  @unsubscribed
end

Instance Method Details

#emailsArray<String>

Extract and seperate emails from qp_emails.

Returns:

  • (Array<String>)

    Emails.



44
45
46
47
48
# File 'lib/questionpro_rails/email_list.rb', line 44

def emails
  unless self.qp_emails.nil?
    return self.qp_emails.split(',')
  end
end

#statisticsQuestionproRails::EmailListStatistic

Extract the email list statistics from qp_statistics attribute.

Returns:



31
32
33
34
35
36
37
38
39
# File 'lib/questionpro_rails/email_list.rb', line 31

def statistics
  extracted_statistics = []

  unless self.qp_statistics.nil?
    extracted_statistics.push(EmailListStatistic.new(qp_statistics))
  end

  return extracted_statistics
end