public
Description: Rails Plugin to access MailChimp
Homepage:
Clone URL: git://github.com/mandarinsoda/acts_as_chimp.git
commit  2d6587dc15ec11b3ab98b94e8558a760270ceec3
tree    ecf76878ec712c95b5494a81e064592f9b1134c2
parent  89f57e514418986fc5b562989399ebdd9982c720
name age message
file .gitignore Fri Oct 31 14:13:54 -0700 2008 adding more campaign methods [mandarinsoda]
file .loadpath Fri Oct 31 14:13:54 -0700 2008 adding more campaign methods [mandarinsoda]
file MIT-LICENSE Mon Apr 07 10:22:44 -0700 2008 first commit [Matthew Carlson]
file README Fri May 08 15:48:06 -0700 2009 removed mail merge doc example, started remote ... [mandarinsoda]
file Rakefile Fri May 08 15:48:06 -0700 2009 removed mail merge doc example, started remote ... [mandarinsoda]
directory generators/ Tue Oct 28 17:57:49 -0700 2008 more stuff [mandarinsoda]
file init.rb Wed Oct 29 12:27:02 -0700 2008 adding more campaign methods and tinkering with... [mandarinsoda]
file install.rb Mon Apr 07 10:22:44 -0700 2008 first commit [Matthew Carlson]
directory lib/ Sun May 10 07:22:23 -0700 2009 removed mail merge doc example, started remote ... [mandarinsoda]
file mail_chimp.yml.tpl Mon Apr 07 10:22:44 -0700 2008 first commit [Matthew Carlson]
directory tasks/ Mon Apr 07 10:22:44 -0700 2008 first commit [Matthew Carlson]
directory test/ Sun May 10 07:22:23 -0700 2009 removed mail merge doc example, started remote ... [mandarinsoda]
README
ActsAsChimp
===========

Simple hook to add or remove a user to/from a MailChimp mailing list.

== Installation

You should have a user table, MailChimp account and mailing list setup that expects email, first_name and last_name.  
Installation will copy a mail_chimp.yml configuration file to your config directory.  Add your MailChimp login 
information to this file so we can use the APIs.

== Usage

This plugin is fairly stripped down at the moment and is directed at a fairly specific use case (aka: Sign up for our 
beta sorta deal).  We're using restful_authentication for our use case and more or less are assuming you're doing the 
same (or have a similar setup with a user table - we're not dependent on that plugin, but its a damn good one if you're 
not using it).  

We add user first name, last name and email address to our MailChimp mailing list, and we've likewise assumed you'll 
want to do the same.  As such, we've provided a script to create a migration to add user first and last names to your 
users table if they're not already there.  The sign-up forms are up to you and any additional fields are up to you.  


After running the migrations, you can just add your credentials to the mail_chimp.yml file and then add the following to 
your user model (NOTE: mail merge variables are dependent upon what you have setup in your MailChimp mailing list):

acts_as_chimp :mailing_list_id => 'your_list_id', :mail_merge => {
       "FNAME" => :first_name, "LNAME" => :last_name }
      

You can get your list id by using the ChimpHelper class.  The mail merge arguments correspond to the arguments you setup 
when you created your MailChimp list.       

and we'll take care of adding the user to the mail chimp list you specify with an after save callback. 

If you need to figure out your mail chimp mail list id, we've provided some helper methods for you in the ChimpHelper 
class. 


=== Prepare database

Generate and apply the migration if you need to:

  script/generate acts_as_chimp_migration
  rake db:migrate

Example
=======

Interacting with the ChimpHelper to get your mailing list id:

Instantiate new helper:
c = ChimpHelper.new

Login to get authorized:
authorization_info = c.login('user', 'login')

Pass authorization info and mailing list name to method:
list = c.mailing_list_info(authorization_info,"Test")


In order to add a user to a mailing list.  Add the following to your User model:
acts_as_chimp :mailing_list_id => 'your_list_id'

Your User model should have an email, first_name and last_name.  

A user will be removed from a mailing list post_destroy as well.  


Copyright (c) 2008 MandarinSoda, released under the MIT license