makeup
This commit is contained in:
@@ -2,24 +2,23 @@ class MailChimpBatchUpdate
|
|||||||
def self.update_all(api_key, list_id)
|
def self.update_all(api_key, list_id)
|
||||||
subscribers = []
|
subscribers = []
|
||||||
Supporter.each do |supporter|
|
Supporter.each do |supporter|
|
||||||
subscriber = {
|
subscribers.push(subscriber supporter)
|
||||||
'EMAIL' => { 'email' => supporter.email },
|
|
||||||
'language' => supporter.language,
|
|
||||||
:EMAIL_TYPE => 'html',
|
|
||||||
:merge_vars => {
|
|
||||||
'EMAIL' => supporter.email,
|
|
||||||
'FNAME' => supporter.first_name,
|
|
||||||
'LNAME' => supporter.last_name,
|
|
||||||
'SUPPORT' => supporter.support,
|
|
||||||
'MEMBERSHIP' => supporter.li_membership.to_s,
|
|
||||||
'AGE' => supporter.age_category,
|
|
||||||
'LANG' => supporter.language
|
|
||||||
}
|
|
||||||
}
|
|
||||||
subscribers.push(subscriber)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mailchimp = Mailchimp::API.new(api_key)
|
mailchimp = Mailchimp::API.new(api_key)
|
||||||
mailchimp.lists.batch_subscribe(list_id, subscribers, false, true, false)
|
mailchimp.lists.batch_subscribe(list_id, subscribers, false, true, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.subscriber(supporter)
|
||||||
|
{ 'EMAIL' => { 'email' => supporter.email }, 'language' => supporter.language, :EMAIL_TYPE => 'html',
|
||||||
|
:merge_vars => {
|
||||||
|
'EMAIL' => supporter.email,
|
||||||
|
'FNAME' => supporter.first_name,
|
||||||
|
'LNAME' => supporter.last_name,
|
||||||
|
'SUPPORT' => supporter.support,
|
||||||
|
'MEMBERSHIP' => supporter.li_membership.to_s,
|
||||||
|
'AGE' => supporter.age_category,
|
||||||
|
'LANG' => supporter.language
|
||||||
|
} }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user