lib/turntabler/client.rb
def on(event, options = {}, &block)
      event = event.to_sym
      @event_handlers[event] ||= []
      @event_handlers[event] << Handler.new(event, options, &block)
      true
    end
def on(event, options = {}, &block)
      event = event.to_sym
      @event_handlers[event] ||= []
      @event_handlers[event] << Handler.new(event, options, &block)
      true
    end
Registers a handler to invoke when an event occurs in Turntable.

 @param [Symbol] event The event to register a handler for
 @param [Hash] options The configuration options for the handler
 @option options [Hash] :if Specifies a set of key-value pairs that must be matched in the event data in order to run the handler
 @option options [Boolean] :once (false) Whether to only run the handler once
 @return [true]

 == Client Events

 * +:reconnected+ - The client reconnected (and re-entered any room that the user was previously in)

 @example
   client.on :reconnected do
     client.room.dj
     # ...
   end

 == Room Events

 * +:room_updated+ - Information about the room was updated
 * +:room_description_updated+ - The room's description was updated

 @example
   client.on :room_updated do |room| # Room
     puts room.description
     # ...
   end

   client.on :room_description_updated do |room| # Room
     puts room.description
     # ...
   end

 == User Events

 * +:user_entered+ - A user entered the room
 * +:user_left+ - A user left the room
 * +:user_booted+ - A user has been booted from the room
 * +:user_updated+ - A user's profile was updated
 * +:user_name_updated+ - A user's name was updated
 * +:user_avatar_updated+ - A user's avatar was updated
 * +:user_spoke+ - A user spoke in the chat room

 @example
   client.on :user_entered do |user| # User
     puts user.id
     # ...
   end

   client.on :user_left do |user| # User
     puts user.id
     # ...
   end

   client.on :user_booted do |boot| # Boot
     puts boot.user.id
     puts boot.reason
     # ...
   end

   client.on :user_updated do |user| # User
     puts user.name
     # ...
   end

   client.on :user_name_updated do |user| # User
     puts user.name
     # ...
   end

   client.on :user_avatar_updated do |user| # User
     puts user.avatar.id
     # ...
   end

   client.on :user_stickers_updated do |user| # User
     puts user.stickers.map {|sticker| sticker.id}
     # ...
   end

   client.on :user_spoke do |message| # Message
    puts message.content
     # ...
   end

 == DJ Events

 * +:fan_added+ - A new fan was added by a user in the room
 * +:fan_removed+ - A fan was removed from a user in the room

 @example
   client.on :fan_added do |user, fan_of| # User, User
     puts user.id
     # ...
   end

   client.on :fan_removed do |user, count| # User, Fixnum
     puts user.id
     # ...
   end

 == DJ Events

 * +:dj_added+ - A new DJ was added to the stage
 * +:dj_removed+ - A DJ was removed from the stage
 * +:dj_escorted_off+ - A DJ was escorted off the stage by a moderator
 * +:dj_booed_off+ - A DJ was booed off the stage

 @example
   client.on :dj_added do |user| # User
     puts user.id
     # ...
   end

   client.on :dj_removed do |user| # User
     puts user.id
     # ...
   end

   client.on :dj_escorted_off do |user, moderator| # User, User
     puts user.id
     # ...
   end

   client.on :dj_booed_off do |user| # User
     puts user.id
     # ...
   end

 == Moderator Events

 * +:moderator_added+ - A new moderator was added to the room
 * +:moderator_removed+ - A moderator was removed from the room

 @example
   client.on :moderator_added do |user| # User
     puts user.id
     # ...
   end

   client.on :moderator_removed do |user| # User
     puts user.id
     # ...
   end

 == Song Events

 * +:song_unavailable+ - Indicates that there are no more songs to play in the room
 * +:song_started+ - A new song has started playing
 * +:song_ended+ - The current song has ended.  This is typically followed by a +:song_started+ or +:song_unavailable+ event.
 * +:song_voted+ - One or more votes were cast for the song
 * +:song_snagged+ - A user in the room has queued the current song onto their playlist
 * +:song_skipped+ - A song was skipped due to either the dj skipping it or too many downvotes
 * +:song_moderated+ - A song was forcefully skipped by a moderator
 * +:song_blocked+ - A song was prevented from playing due to a copyright claim

 @example
   client.on :song_unavailable do
     # ...
   end

   client.on :song_started do |song| # Song
     puts song.title
     # ...
   end

   client.on :song_ended do |song| # Song
     puts song.title
     # ...
   end

   client.on :song_voted do |song| # Song
     puts song.up_votes_count
     puts song.down_votes_count
     puts song.votes
     # ...
   end

   client.on :song_snagged do |snag| # Snag
     puts snag.user.id
     puts snag.song.id
     # ...
   end

   client.on :song_skipped do |song| # Song
     puts song.title
     # ...
   end

   client.on :song_moderated do |song, moderator| # Song, User
     puts song.title
     puts moderator.id
     # ...
   end

   client.on :song_blocked do |song| # Song
     puts song.id
     # ...
   end

   client.on :song_limited do |song| # Song
     puts song.id
     # ...
   end

 == Messaging Events

 * +:message_received+ - A private message was received from another user in the room

 @example
   client.on :message_received do |message| # Message
     puts message.content
     # ...
   end