Module: VkMusic::Utility::AudioDataParser

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

Overview

Parse Audio from Array of audio data

Class Method Summary collapse

Class Method Details

.call(data, client_id) ⇒ Audio

Parameters:

  • data (Array)
  • client_id (Integer)

Returns:



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

def call(data, client_id)
  url_encoded = get_url_encoded(data)
  _add_hash, _edit_hash, _action_hash, _delete_hash, _teplace_hash, url_hash = get_secrets(data)

  Audio.new(id: data[0], owner_id: data[1],
            secret1: url_hash, secret2: url_hash,
            artist: CGI.unescapeHTML(data[4]), title: CGI.unescapeHTML(data[3]),
            duration: data[5],
            url_encoded: url_encoded, url: nil, client_id: client_id)
end