Class: ShowroomApi::Live
- Inherits:
-
Object
- Object
- ShowroomApi::Live
- Defined in:
- lib/showroom_api.rb
Overview
This class provides static methods for live rooms
Class Method Summary collapse
-
.age_verification(room_id) ⇒ boolean
age verification.
-
.comment_log(room_id) ⇒ Array
get room’s comment log.
-
.current_user(room_id) ⇒ Hash
get logged in user’s info.
-
.enquete_result(room_id) ⇒ Hash
get room’s survey result.
-
.first_stream_url ⇒ String
get the stream url of the first room in the list of onlives.
-
.gift_list(room_id) ⇒ Hash
get room’s available gift.
-
.gift_log(room_id) ⇒ Array
get room’s gift log.
-
.live_info(room_id) ⇒ Hash
get the info of the room.
-
.onlive_num ⇒ Integer
get the count of live rooms.
-
.onlives(size = nil) ⇒ Array
get the array of room categories and their available live rooms.
-
.polling(room_id) ⇒ Hash
get the live status of the room.
-
.room_ids(size) ⇒ Array
get the id of the first room in the list of onlives.
-
.stage_gift_list(room_id) ⇒ Array
get the list of gifts the room received.
-
.stage_user_list(room_id) ⇒ Array
get the list of users in the room.
-
.streaming_url(room_id) ⇒ Array
get the list of room’s streaming URLs.
-
.summary_ranking(room_id) ⇒ Array
get room’s ranking summary.
-
.telop(room_id) ⇒ Hash
telop.
Class Method Details
.age_verification(room_id) ⇒ boolean
age verification
99 100 101 |
# File 'lib/showroom_api.rb', line 99 def self.age_verification(room_id) return send_request("age_verification",room_id)[:is_passed] end |
.comment_log(room_id) ⇒ Array
get room’s comment log
154 155 156 |
# File 'lib/showroom_api.rb', line 154 def self.comment_log(room_id) return send_request("comment_log",room_id)[:comment_log] || [] end |
.current_user(room_id) ⇒ Hash
get logged in user’s info
110 111 112 |
# File 'lib/showroom_api.rb', line 110 def self.current_user(room_id) return send_request("current_user",room_id) end |
.enquete_result(room_id) ⇒ Hash
get room’s survey result
132 133 134 |
# File 'lib/showroom_api.rb', line 132 def self.enquete_result(room_id) return send_request("enquete_result",room_id) end |
.first_stream_url ⇒ String
get the stream url of the first room in the list of onlives
55 56 57 |
# File 'lib/showroom_api.rb', line 55 def self.first_stream_url return onlives(1)[0][:lives][0][:streaming_url_list][0][:url] end |
.gift_list(room_id) ⇒ Hash
get room’s available gift
176 177 178 |
# File 'lib/showroom_api.rb', line 176 def self.gift_list(room_id) return send_request("gift_list",room_id) end |
.gift_log(room_id) ⇒ Array
get room’s gift log
165 166 167 |
# File 'lib/showroom_api.rb', line 165 def self.gift_log(room_id) return send_request("gift_log",room_id)[:gift_log] || [] end |
.live_info(room_id) ⇒ Hash
get the info of the room
66 67 68 |
# File 'lib/showroom_api.rb', line 66 def self.live_info(room_id) return send_request("live_info",room_id) end |
.onlive_num ⇒ Integer
get the count of live rooms
208 209 210 |
# File 'lib/showroom_api.rb', line 208 def self.onlive_num return send_request("onlive_num",nil)[:num] end |
.onlives(size = nil) ⇒ Array
get the array of room categories and their available live rooms
20 21 22 23 24 25 26 27 |
# File 'lib/showroom_api.rb', line 20 def self.onlives(size=nil) data=send_request("onlives",nil)[:onlives] cnt=ShowroomApi.to_integer(size) if !cnt.nil? && cnt > 0 return data[0..(cnt-1)] end return data end |
.polling(room_id) ⇒ Hash
get the live status of the room
88 89 90 |
# File 'lib/showroom_api.rb', line 88 def self.polling(room_id) return send_request("polling",room_id) end |
.room_ids(size) ⇒ Array
get the id of the first room in the list of onlives
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/showroom_api.rb', line 36 def self.room_ids(size) arr=[] cnt=ShowroomApi.to_integer(size) return [] if cnt.nil? || cnt <= 0 rooms=onlives(1) rooms[0][:lives].each_with_index do |room,i| break if i>=cnt arr<<room[:room_id] end #$stderr.puts arr return arr end |
.stage_gift_list(room_id) ⇒ Array
get the list of gifts the room received
187 188 189 |
# File 'lib/showroom_api.rb', line 187 def self.stage_gift_list(room_id) return send_request("stage_gift_list",room_id)[:stage_gift_list] || [] end |
.stage_user_list(room_id) ⇒ Array
get the list of users in the room
198 199 200 |
# File 'lib/showroom_api.rb', line 198 def self.stage_user_list(room_id) return send_request("stage_user_list",room_id)[:stage_user_list] || [] end |
.streaming_url(room_id) ⇒ Array
get the list of room’s streaming URLs
77 78 79 |
# File 'lib/showroom_api.rb', line 77 def self.streaming_url(room_id) send_request("streaming_url",room_id)[:streaming_url_list] || [] end |
.summary_ranking(room_id) ⇒ Array
get room’s ranking summary
143 144 145 |
# File 'lib/showroom_api.rb', line 143 def self.summary_ranking(room_id) return send_request("summary_ranking",room_id)[:ranking] || [] end |
.telop(room_id) ⇒ Hash
telop
121 122 123 |
# File 'lib/showroom_api.rb', line 121 def self.telop(room_id) return send_request("telop",room_id) end |