Module: Scamp::Rooms

Included in:
Scamp
Defined in:
lib/scamp/rooms.rb

Instance Method Summary collapse

Instance Method Details

#join(room_id) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/scamp/rooms.rb', line 11

def join(room_id)
  logger.info "Joining room #{room_id}"
  url = "https://#{subdomain}.campfirenow.com/room/#{room_id}/join.json"
  http = EventMachine::HttpRequest.new(url).post :head => {'Content-Type' => 'application/json', 'authorization' => [api_key, 'X']}
  
  http.errback { logger.error "Error joining room: #{room_id}" }
  http.callback {
    yield if block_given?
  }
end

#room_id(room_id_or_name) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/scamp/rooms.rb', line 22

def room_id(room_id_or_name)
  if room_id_or_name.is_a? Integer
    return room_id_or_name
  else
    return room_id_from_room_name(room_id_or_name)
  end
end

#room_name_for(room_id) ⇒ Object



30
31
32
33
34
# File 'lib/scamp/rooms.rb', line 30

def room_name_for(room_id)
  data = room_cache_data(room_id)
  return data["name"] if data
  room_id.to_s
end

#uploadObject

TextMessage (regular chat message), PasteMessage (pre-formatted message, rendered in a fixed-width font), SoundMessage (plays a sound as determined by the message, which can be either “rimshot”, “crickets”, or “trombone”), TweetMessage (a Twitter status URL to be fetched and inserted into the chat)



8
9
# File 'lib/scamp/rooms.rb', line 8

def upload
end