Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Gibbon is a simple API wrapper for interacting with MailChimp API version 1.3.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.markdown

gibbon

Gibbon is a simple API wrapper for interacting with MailChimp API 1.3.

Installation

$ gem install gibbon

Requirements

A MailChimp account and API key. You can see your API keys here.

Usage

There are a few ways to use Gibbon:

You can create an instance of the API wrapper:

gb = Gibbon.new("your_api_key")

You can set your api_key globally and call class methods:

Gibbon.api_key = "your_api_key"
Gibbon.lists

You can also set the environment variable 'MAILCHIMP_API_KEY' and Gibbon will use it when you create an instance:

u = Gibbon.new

Fetching data is as simple as calling API methods directly on the wrapper object. Check the API documentation for details.

Fetching Campaigns

For example, to fetch your first 100 campaigns (page 0):

campaigns = gb.campaigns({:start => 0, :limit => 100})

Fetching Lists

Similarly, to fetch your first 100 lists:

lists = gb.lists({:start => 0, :limit=> 100})

More Advanced Examples

Getting batch member information for subscribers looks like this:

info = gb.list_member_info({:id => list_id, :email_address => email_array})

or

info = gb.listMemberInfo({:id => list_id, :email_address => email_array})

Fetch open and click detail for recipients of a particular campaign:

email_stats = gb.campaign_email_stats_aim({:cid => campaign_id, :email_address => email_array})

or

email_stats = gb.campaignEmailStatsAIM({:cid => campaign_id, :email_address => email_array})

Other Stuff

Gibbon defaults to a 30 second timeout. You can optionally set your own timeout (in seconds) like so:

gb.timeout = 5

Notes

As of 0.1.6, gibbon uses ActiveSupport::JSON.decode(). This means code that checked for weird API responses (like "true" on a successful call to "listSubscribe" or similar) will need to be tweaked to handle the boolean JSON.decode() returns as opposed to the string the MailChimp API returns. I understand the extra dependency might be a pain for some.

Thanks

Copyrights

  • Copyright (c) 2010 Amro Mousa. See LICENSE.txt for details.
  • MailChimp (c) 2001-2010 The Rocket Science Group.
Something went wrong with that request. Please try again.