Class: ShowroomApi::Room
- Inherits:
-
Object
- Object
- ShowroomApi::Room
- Defined in:
- lib/showroom_api.rb
Overview
This class provides static methods for rooms
Class Method Summary collapse
-
.event_and_support(room_id) ⇒ Hash
get the info about event and support of the room.
-
.name(room_id) ⇒ Hash
get the name and screen_name of room’s owner.
-
.next_live(room_id) ⇒ Hash
get the room’s next live schedule.
-
.profile(room_id) ⇒ Hash
get the profile info of the room.
-
.settings(room_id) ⇒ Array
get the room’s available performance.
-
.status(room_id) ⇒ Hash
get the status of the room.
Class Method Details
.event_and_support(room_id) ⇒ Hash
get the info about event and support of the room
238 239 240 |
# File 'lib/showroom_api.rb', line 238 def self.event_and_support(room_id) return send_request("event_and_support",room_id) end |
.name(room_id) ⇒ Hash
get the name and screen_name of room’s owner
293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/showroom_api.rb', line 293 def self.name(room_id) url = "https://www.showroom-live.com/room/profile?room_id=#{room_id}" begin hash={} page = Nokogiri::HTML(open(url)) hash[:screen_name] = page.xpath("//ul[contains(@class, 'room-profile-head-action-menu')]/li[1]/a/@href").first.value[1..-1] hash[:name] = page.xpath("//h2[contains(@class, 'room-profile-head-name')]/text()").first.text hash rescue {} end end |
.next_live(room_id) ⇒ Hash
get the room’s next live schedule
260 261 262 |
# File 'lib/showroom_api.rb', line 260 def self.next_live(room_id) return send_request("next_live",room_id) end |
.profile(room_id) ⇒ Hash
get the profile info of the room
249 250 251 |
# File 'lib/showroom_api.rb', line 249 def self.profile(room_id) return send_request("profile",room_id) end |
.settings(room_id) ⇒ Array
get the room’s available performance
271 272 273 |
# File 'lib/showroom_api.rb', line 271 def self.settings(room_id) return send_request("settings",room_id)[:available_performance_type] || [] end |
.status(room_id) ⇒ Hash
get the status of the room
282 283 284 |
# File 'lib/showroom_api.rb', line 282 def self.status(room_id) return send_request("status",room_id) end |