Class: ShowroomApi::Room

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

Overview

This class provides static methods for rooms

Class Method Summary collapse

Class Method Details

.event_and_support(room_id) ⇒ Hash

get the info about event and support of the room

Examples:

::ShowroomLive::Api::Room.event_and_support(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Hash)


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

Examples:

::ShowroomLive::Api::Room.name(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Hash)


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

Examples:

::ShowroomLive::Api::Room.next_live(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Hash)


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

Examples:

::ShowroomLive::Api::Room.profile(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Hash)


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

Examples:

::ShowroomLive::Api::Room.settings(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Array)


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

Examples:

::ShowroomLive::Api::Room.status(room_id)

Parameters:

  • room_id (String)

Returns:

  • (Hash)


282
283
284
# File 'lib/showroom_api.rb', line 282

def self.status(room_id)
  return send_request("status",room_id)
end