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
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request