module VkMusic::Utility::PlaylistSectionLoader
Load sections into playlist
Public Class Methods
call(agent, client_id, owner_id, playlist_id, access_hash, offset, up_to)
click to toggle source
@param agent [Mechanize] @param client_id [Integer] @param owner_id [Integer] @param playlist_id [Integer] @param access_hash [String, nil] @param offset [Integer] @param up_to [Integer] @return [Array<Audio>]
# File lib/vk_music/utility/playlist_section_loader.rb, line 15 def self.call(agent, client_id, owner_id, playlist_id, access_hash, offset, up_to) audios = [] while audios.size < up_to section = Request::PlaylistSection.new(owner_id, playlist_id, access_hash, offset + audios.size, client_id) section.call(agent) audios.concat(section.audios) break if section.audios.empty? || !section.more? end audios.first(up_to) end