Class: Esbit::Room

Inherits:
Object
  • Object
show all
Defined in:
lib/esbit/room.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(room_json, connection) ⇒ Room

Returns a new instance of Room.



5
6
7
8
9
# File 'lib/esbit/room.rb', line 5

def initialize(room_json, connection)
  @id = room_json["id"]
  @name = room_json["name"]
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/esbit/room.rb', line 3

def connection
  @connection
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/esbit/room.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/esbit/room.rb', line 3

def name
  @name
end

Instance Method Details

#say(message) ⇒ Object



11
12
13
14
# File 'lib/esbit/room.rb', line 11

def say(message)
  json_message = {message: {type: 'TextMessage', body: message}}
  @connection.post "/room/#{@id}/speak", json_message
end