Created: 2008-07-28 20:04
Updated: 2016-05-08 11:16



This program is a simple Ruby client for the EmailLabs API. We're releasing it initially as an example of a working API client. It will probably require some modification on your part, as it's highly specialized for our particular purposes. If you find it useful, please send us patches so that we can make it more full-featured.


We need to be able to add users to a list with different demographic information, and send email to individual users on our list. We've defined a method_missing which handles methods of the formats subscribe_user_to_[mailing] and send_[mailing]. These methods reference the MAILING_LISTS class variable. Since it's so highly specialized, method_missing is deceptively unimportant; the protected methods are more universal, and more interesting.

The main method is send_request, which takes a type and an activity (see the API documentation for more information), as well as a block where the request body is defined. Built on top of that are subscribe_user and send_email, which behave as expected. By looking through these three methods, you should be able to get a good idea of how to interact with the EmailLabs API.


EmailLabsClient uses Builder to create XML for requests. We also require ActiveSupport for the .blank? method, but that can be removed if you don't need that functionality. The tests use Test/Unit, Mocha, and Shoulda.

Copyright (c) 2008 Viget Labs, released under the MIT license

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more