Created
August 8, 2013 14:19
-
-
Save skwp/6184992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
checkout = CheckoutOrder.new current_user, params | |
checkout.subscribe(AnalyticsListener.new) | |
checkout.on(:checkout_success) do |order| | |
respond_with ... | |
end | |
checkout.on(:checkout_failed_for_one_reason) do |order| | |
do_a_thing... | |
end | |
checkout.on(:checkout_failed_for_another_reason) do |order| | |
do_a_thing... | |
end | |
checkout.do_checkout | |
end | |
class AnalyticsListener | |
def checkout_success | |
# notify google analytics / kissmetrics | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment