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

Defined Under Namespace

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

Constant Summary collapse

BASE_URL =
"http://www.vagalume.com.br/api/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_json = MultiJson.decode(open(request_url).read)
  search_result = Vagalume::SearchResult.fetch(result_json)
end


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

def print(artist, song, options)
  search = find(artist, song)
  puts Vagalume::LyricFormatter.format(search, options)
end