<commit_before>h1. Pant-hoot

bq. The pant-hoot is a vocalization of chimpanzees that begins with breathy, low-pitched hoots that makes a transition into a series of quicker, higher-pitched in-and-out pants building to a loud climax.

Pant-hoot is a gem that provides the API MailChimp expects for its webhooks, and then passes on those notifications to you in a sensible, Ruby-infused manner. If you're using Rails, then it functions as a Rails Engine. Otherwise, you'll have a Rack app to use as you see fit.

h2. Usage

Add the gem to your Gemfile:

<pre><code>gem 'panthoot', '~> 0.1.0'</code></pre>

If you're using Rails, this will automatically add a route at @/panthoot/hooks@ to capture messages from MailChimp. Otherwise, mount the Rack app @Panthoot::App@ to wherever you like. Make sure you add that URL to your MailChimp account settings, otherwise this will all be for naught.

The next step is to tell Panthoot that you want to be informed whenever MailChimp sends something your way. In Rails, stick the configuration in an initializer, but for Rack just make sure it's set as part of your app load process.

<pre><code>Panthoot.configure do |config|
  config.listener = MailChimpListener
end</code></pre>

The listener class is something you'll need to define. You can call this class whatever you like, but it should respond to the following *class* methods:

* .subscribe(subscription, fired_at)
* .unsubscribe(unsubscription, fired_at)
* .profile_update(update, fired_at)
* .email_address_change(change, fired_at)
* .email_cleaned(clean, fired_at)
* .campaign_sending_status(status, fired_at)

As you can probably guess from the method signatures, each notification will provide an object with all the data from MailChimp, plus the time the notification was fired. When the methods get called, you get to do your thing with the data provided. Have fun!

h2. Contributing

# Fork it
# Create your feature branch (@git checkout -b my-new-feature@)
# Commit your changes (@git commit -am 'Added some feature'@)
# Push to the branch (@git push origin my-new-feature@)
# Create new Pull Request

Pull requests without tests may be rejected purely on that basis. You've been warned.

h2. Credits

Copyright (c) 2012, Panthoot is developed and maintained by <NAME> on behalf of "Inspire9":http://inspire9.com, and is released under the open MIT Licence.
<commit_msg>Updating the README to reflect the new changes.<commit_after>h1. Pant-hoot

bq. The pant-hoot is a vocalization of chimpanzees that begins with breathy, low-pitched hoots that makes a transition into a series of quicker, higher-pitched in-and-out pants building to a loud climax.

Pant-hoot is a gem that provides the API MailChimp expects for its webhooks, and then passes on those notifications to you in a sensible, Ruby-infused manner. If you're using Rails, then it functions as a Rails Engine. Otherwise, you'll have a Rack app to use as you see fit.

h2. Usage

Add the gem to your Gemfile:

<pre><code>gem 'panthoot', '~> 0.2.0'</code></pre>

If you're using Rails, this will automatically add a route at @/panthoot/hooks@ to capture messages from MailChimp. Otherwise, mount the Rack app @Panthoot::App.new@ to wherever you like. Make sure you add that URL to your MailChimp account settings, otherwise this will all be for naught.

The next step is to tell Panthoot that you want to be informed whenever MailChimp sends something your way. In Rails, stick the configuration in an initializer, but for Rack just make sure it's set as part of your app load process.

<pre><code>ActiveSupport::Notifications.subscribe('subscribe.panthoot') do |*args|
  event        = ActiveSupport::Notifications::Event.new(*args)
  subscription = event.payload[:subscription]
  fired_at     = event.payload[:fired_at]

  # use subscription data however you wish
end</code></pre>

The above sample is just listening to new subscriptions, but there's other events as well - the event prefix matches the payload key in each case:

* subscribe
* unsubscribe
* profile_update
* email_address_change
* email_cleaned
* campaign_sending_status

As you can see in the example, each notification will provide an object with all the data from MailChimp, plus the time the notification was fired. When the notification is fired, you get to do your thing with the data provided. Have fun!

h2. Contributing

# Fork it
# Create your feature branch (@git checkout -b my-new-feature@)
# Commit your changes (@git commit -am 'Added some feature'@)
# Push to the branch (@git push origin my-new-feature@)
# Create new Pull Request

Pull requests without tests may be rejected purely on that basis. You've been warned.

h2. Credits

Copyright (c) 2013, Panthoot is developed and maintained by <NAME> on behalf of "Inspire9":http://inspire9.com, and is released under the open MIT Licence.

{'fraction_non_alphanumeric': 0.06940714728361909, 'fraction_numerical': 0.005370791158851477, 'mean_word_length': 4.514806378132119, 'pattern_counts': {'":': 2, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2523040', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1345, 'n_words': 688}