Skip to content

Instantly share code, notes, and snippets.

View jfriedlaender's full-sized avatar

Joel Friedlaender jfriedlaender

View GitHub Profile
@jfriedlaender
jfriedlaender / hooks_controller.rb
Created April 23, 2011 04:37 — forked from ryansch/hooks_controller.rb
Rails 3 Controller for Chargify Webhooks
require 'digest/md5'
class Chargify::HooksController < ApplicationController
protect_from_forgery :except => :dispatch_handler
before_filter :verify, :only => :dispatch_handler
EVENTS = %w[ test signup_success signup_failure renewal_success renewal_failure payment_success payment_failure billing_date_change subscription_state_change subscription_product_change ].freeze
def dispatch_handler
event = params[:event]