README.textile in chargify-loops-0.2.0 vs README.textile in chargify-loops-0.3.0

- old
+ new

@@ -6,11 +6,11 @@ h2. Installation and Usage Add the following to your Gemfile: -<pre><code>gem 'chargify-loops', '~> 0.1.0'</code></pre> +<pre><code>gem 'chargify-loops', '~> 0.3.0'</code></pre> Then add an initializer for your loops, and provide your shared key: <pre><code># config/initializers/chargify_loops.rb Chargify::Loops.shared_key = 'secret-key-from-chargify' @@ -19,9 +19,14 @@ Emails.welcome(payload['subscription']['customer']['email']).deliver end Chargify::Loops.loop! :payment_failure do |payload| Banker.loan payload['payment']['amount_in_cents'] +end + +# Or catch all events: +Chargify::Loops.loop! :all do |event, payload| + Events.store event, payload end</code></pre> If a web hook is invalid, it'll never hit your loops - so you're only dealing with valid hook requests. All hash keys will be strings (I normally prefer symbols, but hashes within hashes had string keys, so opting with that as a default). Also: it's best to keep your loops short and sweet - don't put business logic in your initializer, but somewhere else where you've got some test coverage. As a rule of thumb, if you've got more than one line inside a loop block, then you should probably consider whether that code could be somewhere else.