Class: SleepRoom::Record::API::RoomAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/sleeproom/record/api/room_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(room_url_key) ⇒ RoomAPI

Returns a new instance of RoomAPI.



7
8
9
10
11
# File 'lib/sleeproom/record/api/room_api.rb', line 7

def initialize(room_url_key)
  @url = ROOM_API + "?room_url_key=" + room_url_key
  @json = nil
  get
end

Instance Method Details

#broadcast_hostObject



25
26
27
# File 'lib/sleeproom/record/api/room_api.rb', line 25

def broadcast_host
  @json["broadcast_host"].to_s
end

#broadcast_keyObject



21
22
23
# File 'lib/sleeproom/record/api/room_api.rb', line 21

def broadcast_key
  @json["broadcast_key"].to_s
end

#get(task: Async::Task.current) ⇒ Object



13
14
15
# File 'lib/sleeproom/record/api/room_api.rb', line 13

def get(task: Async::Task.current)
  @json = API.get(@url).wait
end

#live?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sleeproom/record/api/room_api.rb', line 17

def live?
  @json["is_live"]
end

#room_idObject



29
30
31
# File 'lib/sleeproom/record/api/room_api.rb', line 29

def room_id
  @json["room_id"]
end

#room_nameObject



33
34
35
# File 'lib/sleeproom/record/api/room_api.rb', line 33

def room_name
  @json["room_name"]
end