Module: Vk::DSL::Audio
- Included in:
- Vk::DSL
- Defined in:
- lib/vk/dsl/audio.rb
Constant Summary collapse
- AUDIO_SORT =
{ popularity: 2, duration: 1, date: 0 }
Instance Method Summary collapse
- #get_audio_albums(owner_id, options = {}) ⇒ Object
- #get_audios(owner_id, options = {}) ⇒ Object
- #get_lyrics(lyrics_id) ⇒ Vk::Audio::Lyrics
- #search_lyrics(q, options = {}) ⇒ Object
Instance Method Details
#get_audio_albums(owner_id, options = {}) ⇒ Object
26 27 28 |
# File 'lib/vk/dsl/audio.rb', line 26 def get_audio_albums(owner_id, = {}) Vk::Result.new('audio.getAlbums', Vk::Audio::Album, .merge(owner_id: owner_id)) end |
#get_audios(owner_id, options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/vk/dsl/audio.rb', line 17 def get_audios(owner_id, = {}) fail NotImplementedError, ':need_user is not supported for audio.get method' if .key?(:need_user) Vk::Result.new('audio.get', Vk::Audio, .merge(owner_id: owner_id)) end |
#get_lyrics(lyrics_id) ⇒ Vk::Audio::Lyrics
32 33 34 |
# File 'lib/vk/dsl/audio.rb', line 32 def get_lyrics(lyrics_id) Vk::Audio::Lyrics.new(request('audio.getLyrics', {lyrics_id: lyrics_id})) end |
#search_lyrics(q, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/vk/dsl/audio.rb', line 41 def search_lyrics(q, = {}) [:auto_complete] = !![:auto_complete] ? 1 : 0 if .key?(:auto_complete) [:lyrics] = !![:lyrics] ? 1 : 0 if .key?(:lyrics) [:performer_only] = !![:performer_only] ? 1 : 0 if .key?(:performer_only) [:sort] = AUDIO_SORT[[:sort]] if [:sort].is_a?(Symbol) [:search_own] = !![:search_own] ? 1 : 0 if .key?(:search_own) Vk::Result.new('audio.search', Vk::Audio, .merge(q: q)) end |