README.md in omnihooks-0.0.3 vs README.md in omnihooks-0.0.4

- old
+ new

@@ -1,31 +1,52 @@ -# OmniHooks +# OmniHooks: Standardized Multi-Provider Webhooks -TODO: Write a gem description +## Introduction -## Installation +OmniHooks is a library that standardizes multi-provider webhooks for web applications. It was created to be powerful, flexible, and do as little as possible. Any developer can create strategies for OmniHooks that can handle webhooks via disparate systems. -Add this line to your application's Gemfile: +In order to use OmniHooks in your applications, you will need to leverage one or more strategies. These strategies are generally released individually as RubyGems, and you can see a [community maintained list](https://github.com/dropstream/omnihooks/wiki/List-of-Strategies) on the wiki for this project. -```ruby -gem 'omnihooks' -``` +## Getting Started -And then execute: +Each OmniHook strategy is a Rack Middleware. That means that you can use it the same way that you use any other Rack middleware. For example, to use the built-in Developer strategy in a Sinatra application I might do this: - $ bundle +````ruby +require 'sinatra' +require 'omnihooks' -Or install it yourself as: +class MyApplication < Sinatra::Base + use Rack::Session::Cookie + use OmniHooks::Strategies::Developer +end +```` - $ gem install omnihooks +Because OmniHooks is built for multi-provider webhooks, I may want to leave room to run multiple strategies. For this, the built-in OmniHooks::Builder class gives you an easy way to specify multiple strategies. -## Usage +````ruby +require 'sinatra' +require 'omnihooks' -TODO: Write usage instructions here +class MyApplication < Sinatra::Base + use Rack::Session::Cookie + use OmniHooks::Builder do + provider :developer do |p| + p.configure do |c| + c.subscribe 'foo', Proc.new { |event| nil } + end + end + provider :core_warehouse do |p| + p.configure do |c| + c.subscribe 'Shipment', Proc.new { |event| nil } + end + end + end +end +```` -## Contributing +## Logging -1. Fork it ( https://github.com/[my-github-username]/omnihooks/fork ) -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 a new Pull Request +OmniHooks supports a configurable logger. By default, OmniHooks will log to STDOUT but you can configure this using `OmniHooks.config.logger`: + +## Resources + +The [OmniHooks Wiki](https://github.com/dropstream/omnihooks/wiki) has actively maintained in-depth documentation for OmniHooks. It should be your first stop if you are wondering about a more in-depth look at OmniHooks, how it works, and how to use it.