lib/turntabler/room_directory.rb
def create(name, attributes = {})
      assert_valid_keys(attributes, :privacy, :dj_capacity, :dj_minimum_points)
      attributes = {:privacy => 'public', :dj_capacity => 5, :dj_minimum_points => 0}.merge(attributes)

      # Convert attribute names over to their Turntable equivalent
      {:dj_capacity => :max_djs, :dj_minimum_points => :djthreshold}.each do |from, to|
        attributes[to] = attributes.delete(from) if attributes[from]
      end

      data = api('room.create', attributes.merge(:room_name => name))
      room = Room.new(client, attributes.merge(:_id => data['roomid'], :shortcut => data['shortcut'], :name => name))
      room.enter
      room
    end
def create(name, attributes = {})
      assert_valid_keys(attributes, :privacy, :dj_capacity, :dj_minimum_points)
      attributes = {:privacy => 'public', :dj_capacity => 5, :dj_minimum_points => 0}.merge(attributes)

      # Convert attribute names over to their Turntable equivalent
      {:dj_capacity => :max_djs, :dj_minimum_points => :djthreshold}.each do |from, to|
        attributes[to] = attributes.delete(from) if attributes[from]
      end

      data = api('room.create', attributes.merge(:room_name => name))
      room = Room.new(client, attributes.merge(:_id => data['roomid'], :shortcut => data['shortcut'], :name => name))
      room.enter
      room
    end
def create ( name , attributes = { } ) assert_valid_keys ( attributes , :privacy , :dj_capacity , :dj_minimum_points ) attributes = { :privacy => 'public' , :dj_capacity => 5 , :dj_minimum_points => 0 } . merge ( attributes ) # Convert attribute names over to their Turntable equivalent { :dj_capacity => :max_djs , :dj_minimum_points => :djthreshold } . each do | from , to | attributes [ to ] = attributes . delete ( from ) if attributes [ from ] end data = api ( 'room.create' , attributes . merge ( :room_name => name ) ) room = Room . new ( client , attributes . merge ( :_id => data [ 'roomid' ] , :shortcut => data [ 'shortcut' ] , :name => name ) ) room . enter room end
@api private
 Creates a new room with the given name and configuration.  This should
 only be used if the room doesn't already exist.

 @note This will automatically enter the room when it is created
 @param [String] name The name of the room
 @param [Hash] attributes The initial attributes for the room
 @option attributes [String] :privacy ("public") TheThe level which the room will be made available to others ("public" or "unlisted")
 @option attributes [Fixnum] :dj_capacity (5) The maximum number of DJs allowed
 @option attributes [Fixnum] :dj_minimum_points (0) The minimum number of points required for a user to DJ
 @return [Turntabler::Room]
 @raise [ArgumentError] if an invalid attribute is specified
 @raise [Turntabler::Error] if the command fails
 @example
   rooms.create("Rock Awesomeness")    # => #<Turntabler::Room ...>
@api private Creates a new room with the given name and configuration . This should only be used if the room doesn t already exist .