Module: Vagalume

Extended by:
Vagalume
Included in:
Vagalume
Defined in:
lib/vagalume.rb,
lib/vagalume/song.rb,
lib/vagalume/artist.rb,
lib/vagalume/status.rb,
lib/vagalume/language.rb,
lib/vagalume/search_result.rb,
lib/vagalume/lyric_formatter.rb

Defined Under Namespace

Modules: Language, Status Classes: Artist, LyricFormatter, SearchResult, Song

Constant Summary collapse

BASE_URL =
"http://api.vagalume.com.br/search.php?"

Instance Method Summary collapse

Instance Method Details

#find(artist, song) ⇒ Object



17
18
19
20
21
# File 'lib/vagalume.rb', line 17

def find(artist, song)
  request_url = BASE_URL + "art=#{CGI.escape(artist)}&mus=#{CGI.escape(song)}"
  result = MultiJson.decode(open(request_url).read)
  search_result = Vagalume::SearchResult.new(result)
end

#get_lyric(artist, song, options) ⇒ Object



23
24
25
26
27
# File 'lib/vagalume.rb', line 23

def get_lyric(artist, song, options)
  search = find(artist, song)
  formatter = Vagalume::LyricFormatter.new
  formatter.format(search, options)
end