recurly/recurly-client-ruby — pull request #166 by keysolutions (2014-12-17 03:59:41+00:00)
Title: Webhook Handlers

Adds an API to simplify the handling of webhook requests.

Example usage:

```ruby
notification = Recurly::Webhook.parse(xml_body)

case notification
when Recurly::Webhook::NewAccountNoficiation

# A new account was created
puts "New account #{notification.account.account_code}"

when Recurly::Webhook::NewSubscriptionNotification

# A new subscription was added
puts "New subscription from #{notification.account.account_code}"

# Notifications are not necessarily current. ! relation methods will
# fetch the latest data
puts "Current state #{notification.subscription!.state}"

when Recurly::Webhook::SubscriptionNotification

# A subscription-related notification was sent
puts "Generic subscription notification by #{notification.account!.account_code}"

end
```