Class: SleepRoom::Record::API::StreamingAPI
- Inherits:
-
Object
- Object
- SleepRoom::Record::API::StreamingAPI
- Defined in:
- lib/sleeproom/record/api/streaming_api.rb
Instance Method Summary collapse
- #get(task: Async::Task.current) ⇒ Object
-
#initialize(room_id) ⇒ StreamingAPI
constructor
A new instance of StreamingAPI.
- #streaming_url ⇒ Object
Constructor Details
#initialize(room_id) ⇒ StreamingAPI
Returns a new instance of StreamingAPI.
7 8 9 10 11 |
# File 'lib/sleeproom/record/api/streaming_api.rb', line 7 def initialize(room_id) @url = STREAMING_API + "?room_id=" + room_id.to_s + "&ignore_low_stream=1" @json = nil get end |
Instance Method Details
#get(task: Async::Task.current) ⇒ Object
13 14 15 |
# File 'lib/sleeproom/record/api/streaming_api.rb', line 13 def get(task: Async::Task.current) @json = API.get(@url).wait end |
#streaming_url ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/sleeproom/record/api/streaming_api.rb', line 17 def streaming_url if @json["streaming_url_list"].nil? raise Error.new("streaming url is null.") else @json["streaming_url_list"].sort_by{|hash| -hash["quality"]}.first["url"] end end |