This RubyGem provides access to the Campaign Monitor API (www.campaignmonitor.com/api).
Campaign Monitor recently made some changes to their API.
This fork integrates the following additional changes:
* updates Subscriber#is_subscribed? to work with the latest API. (from amiel) * adds support for array values in custom_field_hash (from oferlin) * API key cleanup (from yyyc514) * added ability to get fetch lists by id using List#GetDetails or List# (from yyyc514) * added support for adding and deleting clients (from yyyc514) * added support for querying CM for countries and timezones (from yyyc514) * added support for creating campaigns (from yyyc514) * general test and api cleanup (from yyyc514)
An account with Campaign Monitor and the API Key. Accounts are free and can be created at www.campaignmonitor.com.
gem install turingstudio-campaign-monitor-ruby
cm = CampaignMonitor.new # assumes you've set CAMPAIGN_MONITOR_API_KEY in your project for client in cm.clients for list in client.lists client.name # => returns the name # modify a subscriber list list.add_subscriber(email, name, custom_fields_hash) list.remove_subscriber(email) list.add_and_resubscribe(email, name, custom_fields_hash) # get subscriber list details subscribers = list.active_subscribers(since_time) unsubscribed = list.unsubscribed(since_time) bounced = list.bounced(since_time) end for campaign in client.campaigns end end