Module: VkMusic::Utility::PostLoader

Defined in:
lib/vk_music/utility/post_loader.rb

Overview

Load wall audios

Class Method Summary collapse

Class Method Details

.call(agent, client_id, owner_id, post_id) ⇒ Array<Audio>

Parameters:

  • agent (Mechanize)
  • client_id (Integer)
  • owner_id (Integer)
  • post_id (Integer)

Returns:



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vk_music/utility/post_loader.rb', line 12

def self.call(agent, client_id, owner_id, post_id)
  page = Request::Post.new(owner_id, post_id, client_id)
  page.call(agent)
  urlles_audios = page.audios

  wall_audios = WallLoader.call(agent, client_id, owner_id, post_id).audios

  urlles_audios
    .map { |urlles| wall_audios.find { |audio| audio.like?(urlles) } }
    .compact
end