Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Note: The official {Mailchimp gem}[http://rubygems.org/gems/mailchimp] is a better alternative to Hominid if you are starting a new project. There is a lot less data-bludgeoning because it uses JSON rather than XML, and it also includes support for the Mandrill API as well.
= Hominid {}[http://travis-ci.org/terra-firma/hominid] {}[https://gemnasium.com/terra-firma/hominid]
Hominid is a Ruby gem that provides a wrapper for interacting with {Mailchimp's}[http://eepurl.com/ew8J] MC, STS and Export API's. Check out the {Mandrill gem}[http://github.com/terra-firma/mandrill] if you are interested in working with the {Mandrill API}[http://mandrillapp.com/api/docs/index.html].
== Requirements
You will need a {Mailchimp}[http://eepurl.com/ew8J] account. Once you have your Mailchimp account set up, you will need to {generate an API key}[http://admin.mailchimp.com/account/api/] in order to get started using Hominid (or you can use OAuth2 as well).
== Installation
(sudo) gem install hominid
== Usage
=== MCAPI
Please refer to the {Mailchimp API Documentation}[http://apidocs.mailchimp.com/api/1.3/] for information about what methods are available, the arguments that can be passed to each method, and the output that the API will return. Start by creating a Hominid object:
h = Hominid::API.new('your_api_key')
You can also override the default configuration by passing in your own when initializing:
h = Hominid::API.new('your_api_key', {:secure => true, :timeout => 60})
Finally, and we're not sure why you would want to, but you can use the older versions of the API if you would like:
h = Hominid::API.new('your_api_key', {:api_version => '1.2'})
You can then run any of the methods that you find in the {Mailchimp API Documentation}[http://apidocs.mailchimp.com/api/1.3/] against it. Simply convert the names to the more Ruby-like underscored versions (e.g. listUpdateMember becomes list_update_member).
MailChimp's API documentation states that several API methods (e.g. listUpdateMember, list_subscribe) require 'array' parameters. Hominid requires many (all?) of these parameters to be passed as hashes, not arrays -- the examples below should all work as-is.
You do not need to pass your api_key to each method, as that is done automatically for you:
h.get_account_details
h.lists
h.list_subscribe(list_id, 'joe@public.com', {'FNAME' => 'Joe', 'LNAME' => 'Public'}, 'html', false, true, true, false) h.list_batch_subscribe(list_id, [{:EMAIL => 'joe@public.com', :EMAIL_TYPE => 'html'}, {:EMAIL => 'jane@doe.com', :EMAIL_TYPE => 'html'}]) h.campaign_create('regular', {:list_id => list_id, ...}, {:html => 'Campaign HTML content', ...}) h.template_add('template_name', 'Template HTML Code') h.list_interest_grouping_add(list_id, 'Grouping Title', 'hidden', ['First Group', 'Second Group', 'Third Group']) h.list_static_segment_add('Sample Static Segment')
The {Mailchimp API}[http://apidocs.mailchimp.com/api/1.3/] supports pagination for some methods, so certain methods will have the following response:
h.lists['total'] => 4 h.lists['data'] => outputs an array of your mailing lists h.lists['data'].first => {"id" => "XXXXXXX", "web_id" => 1234567, "name" => "My Mailing List", ...}
==== Finder Methods
Hominid includes some finder methods for campaigns (see Hominid::Campaign) and lists (see Hominid::List) to help with finding each of these resources:
h.find_list_by_name('my_mailing_list') h.find_list_id_by_name('my_mailing_list') h.find_campaigns_by_list_name('my_mailing_list')
=== STS API
Please refer to the {Mailchimp STS API Documentation}[http://apidocs.mailchimp.com/sts/1.0/] for information about what methods are available, the arguments that can be passed to each method, and the output that the API will return. Start by creating a Hominid object:
s = Hominid::STS.new('your_api_key', {:secure => true})
You can then run any of the methods that you find in the {Mailchimp STS API Documentation}[http://apidocs.mailchimp.com/sts/1.0/] against it. Simply convert the names to the more Ruby-like underscored versions (e.g. listVerifiedEmailAddresses becomes list_verified_email_addresses).
s.list_verified_email_addresses s.verify_email_address('joe@public.com') s.send_email({:to_email => ['joe@public.com'], :text => 'Hello World!'}, false, true) s.get_send_quota
Note that MailChimp will return an error if you attempt to make STS API calls on an account without Amazon SES integration.
=== Export API
Please refer to the {Mailchimp Export API Documentation}[http://apidocs.mailchimp.com/export/1.0/] for information about what methods are available, the arguments that can be passed to each method, and the output that the API will return. Start by creating a Hominid object:
e = Hominid::Export.new('your_api_key', {:secure => true})
You can then run the following methods:
e.list('list_id') e.campaign_subscriber_activit('campaign_id')
== Submitting an Issue
We use the {GitHub issue tracker}[https://github.com/terra-firma/hominid/issues] to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You can indicate support for an existing issue by voting it up. When submitting a bug report, please include a Gist that includes a stack trace and any details that may be necessary to reproduce the bug, including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with failing specs.
== Contributing to Hominid
== Copyright
Copyright (c) 2010 Brian Getting. See LICENSE.txt for further details.
FAQs
Unknown package
We found that hominid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.