Skip to content

Instantly share code, notes, and snippets.

@pdxmph
Created December 21, 2011 00:09
Show Gist options
  • Save pdxmph/1503901 to your computer and use it in GitHub Desktop.
Save pdxmph/1503901 to your computer and use it in GitHub Desktop.
MailChimp: Retrieve Preview of a Template
#!/usr/bin/env ruby
require "rubygems"
require "hominid"
require "net/http"
require "yaml"
config = YAML.load(File.open('smt_config.yml'))
api_key = config["mail_chimp"]["api_key"]
nl_sites = config["sites"]
nl_base = config["nl_backend"]["nl_base_url"]
h = Hominid::API.new(api_key)
templates = h.templates["user"]
templates.each do |t|
temp_id = t["id"].to_i
template = h.template_info(temp_id)
preview = template["preview"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment