Class: CakeMail::SuppressionList

Inherits:
Object
  • Object
show all
Defined in:
lib/cakemail/suppressionlist.rb

Class Method Summary collapse

Class Method Details

.delete_domains(user, domains) ⇒ Object

Deletes one or more domains from the suppression list.

Custom argument :

  • domains = [ ‘domain1.com’, ‘domain2’, …]



97
98
99
# File 'lib/cakemail/suppressionlist.rb', line 97

def delete_domains(user, domains)
  res = user.session.request("CakeMail::API::ClassSuppressionList", "DeleteDomains", { :user_key => user.user_key, :domain => domains })
end

.delete_emails(user, emails) ⇒ Object

Deletes one or more emails from the suppression list.

Custom argument : emails = [ ‘[email protected]’, ‘[email protected]’, … ]



67
68
69
# File 'lib/cakemail/suppressionlist.rb', line 67

def delete_emails(user, emails)
  res = user.session.request("CakeMail::API::ClassSuppressionList", "DeleteEmails", { :user_key => user.user_key, :email => emails })
end

.export_domains(args) ⇒ Object

Exports the suppressed emails.

Arguments :

  • args = { :user => required, :limit => optional, :offset => optional, :count => optional }

Raises:

  • (ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/cakemail/suppressionlist.rb', line 81

def export_domains(args)
  raise ArgumentError if args.nil? or args[:user].nil?
  options = { :user_key => args[:user].user_key }
  options[:limit] = args[:limit] unless args[:limit].nil?
  options[:offset] = args[:offset] unless args[:offset].nil?
  options[:count] = args[:count] unless args[:count].nil?
  res = args[:user].session.request("CakeMail::API::ClassSuppressionList", "ExportDomains", options)
  if !args[:count].nil?
    return res['count']
  end
  return res['record']
end

.export_emails(args) ⇒ Object

Exports the suppressed emails.

Arguments :

  • args = { :user => required, :source_type => optional, :limit => optional, :count => optional, }

Raises:

  • (ArgumentError)


50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cakemail/suppressionlist.rb', line 50

def export_emails(args)
  raise ArgumentError if args.nil? or args[:user].nil?
  options = { :user_key => args[:user].user_key }
  options[:source_type] = arg[:source_type] unless arg[:source_type].nil?
  options[:limit] = arg[:limit] unless arg[:limit].nil?
  options[:offset] = arg[:offset] unless arg[:offset].nil?
  options[:count] = arg[:count] unless arg[:count].nil?
  res = arg[:user].session.request("CakeMail::API::ClassSuppressionList", "ExportEmails", options)
  if !arg[:count].nil?
    return res['count']
  end
  return res['record']
end

.import_domains(user, domains) ⇒ Object

Imports one or more domains into the suppression list.

Custom argument :

  • domains = [ ‘domain1.com’, ‘domain2’, …]



74
75
76
# File 'lib/cakemail/suppressionlist.rb', line 74

def import_domains(user, domains)                    
  res = user.session.request("CakeMail::API::ClassSuppressionList", "ImportDomains", { :domain => domains, :user_key => user.user_key })
end

.import_emails(user, emails) ⇒ Object

Imports one or more emails into the suppression list.

Custom argument : emails = [ ‘[email protected]’, ‘[email protected]’, … ]



43
44
45
# File 'lib/cakemail/suppressionlist.rb', line 43

def import_emails(user, emails)                    
  res = user.session.request("CakeMail::API::ClassSuppressionList", "ImportEmails", { :email => emails, :user_key => user.user_key })
end