Skip to content

A library to keep your even tracking calls in a large rails app from going insane

License

Notifications You must be signed in to change notification settings

architects/eventhub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventHub

EventHub provides a central, globally accessible object to pipe all of your event tracking calls to. It provides a clean, declarative way of responding to these events with things like email or push notifications, calls to external services, etc.

Example

Where you might do...

class User < ActiveRecord::Base
  after_create :send_email_notification
  after_create :send_push_notification

  def send_email_notification
    # Whatever you do
  end

  def send_push_notification
    # Whatever you do
  end
end

You can now do:

class User < ActiveRecord::Base
  after_create :track_creation_event

  def track_creation_event
    EventHub.track(:creation, self)
  end
end

# config/initializers/event_hub.rb

EventHub.on(:creation).of(User) do |user|
  UserMailer.signup_email(user.id)
  UrbanAirship.register_device(user.apns_token)
end

About

A library to keep your even tracking calls in a large rails app from going insane

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages