MultiNotifier

MultiNotifier provides a minimal, modular and adaptable interface for sending notifications in Ruby. It unifies and distills the API for sending notifications to multiple sources with middlewares.

Installation

Add this line to your application's Gemfile:

gem 'multi_notifier'

And then execute:

$ bundle

Or install it yourself as:

$ gem install multi_notifier

Usage

MultiNotifier.build do |builder|
  builder.use :mail, :from => "[email protected]", :to => "[email protected]", :subject => "MultiNotifier notification"
  builder.use :campfire, :access_token => "123", :room => "123", :message => "Hello world"
end.notify_all!

Middlewares

Mail

The mail middleware sends email with the provided settings.

builder.adapter :mail,
  :delivery => {
    :method => Rails.configuration.action_mailer.delivery_method, # delivery method
    :settings => Rails.configuration.action_mailer.send("#{Rails.configuration.action_mailer.delivery_method}_settings") # deivery settings
  },
  :from => "[email protected]", # from email
  :to => "[email protected]", # to email
  :subject => "subject", # email subject
  :text_body => mail_text_body, # email body in text
  :html_body => mail_html_body # email body in html

Travis

The travis middleware restart the latest build with the provided repo.

builder.adapter :travis,
  :access_token => "123", # travis-ci access token
  :repo => "jingweno/multiple_notifier", # travis-ci repo in the format of OWNER/REPO
  :travis_pro => true # whether this repo is built in travis-ci pro

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request