Class: Chimpmunk::EmailTemplate

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/chimpmunk/email_template.rb

Class Method Summary collapse

Class Method Details

.refresh_email_templatesObject

refresh list of templates from mailchimp



14
15
16
17
18
19
20
21
22
23
# File 'lib/chimpmunk/email_template.rb', line 14

def self.refresh_email_templates
  Chimpmunk.mailchimp.templates.list()["user"].each do |template|
  EmailTemplate.where(
    mailchimp_id: "#{template["id"]}",
    name: template["name"],
    layout: template["layout"],
    preview_image: template["preview_image"]
  ).first_or_create
  end
end