class ShowroomApi::Room
This class provides static methods for rooms
Public Class Methods
event_and_support(room_id)
click to toggle source
get the info about event and support of the room
@param room_id [String] @return [Hash]
@example
::ShowroomLive::Api::Room.event_and_support(room_id)
# 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)
click to toggle source
get the name and screen_name of room's owner
@param room_id [String] @return [Hash]
@example
::ShowroomLive::Api::Room.name(room_id)
# 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)
click to toggle source
get the room's next live schedule
@param room_id [String] @return [Hash]
@example
::ShowroomLive::Api::Room.next_live(room_id)
# File lib/showroom_api.rb, line 260 def self.next_live(room_id) return send_request("next_live",room_id) end
profile(room_id)
click to toggle source
get the profile info of the room
@param room_id [String] @return [Hash]
@example
::ShowroomLive::Api::Room.profile(room_id)
# File lib/showroom_api.rb, line 249 def self.profile(room_id) return send_request("profile",room_id) end
settings(room_id)
click to toggle source
get the room's available performance
@param room_id [String] @return [Array]
@example
::ShowroomLive::Api::Room.settings(room_id)
# 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)
click to toggle source
get the status of the room
@param room_id [String] @return [Hash]
@example
::ShowroomLive::Api::Room.status(room_id)
# File lib/showroom_api.rb, line 282 def self.status(room_id) return send_request("status",room_id) end
Private Class Methods
send_request(cmd,room_id)
click to toggle source
performs http request to showroom
@param cmd [String] @param room_id [String] @return [Hash]
# File lib/showroom_api.rb, line 312 def self.send_request(cmd,room_id) ShowroomApi.showroom_live_get_api_data("https://www.showroom-live.com/api/room/#{cmd}?room_id=#{room_id}") end