Sha256: f346f731c0bcef27307e5f8af793a6d0b427782ed5d5251ca633c0f823961ff5
Contents?: true
Size: 751 Bytes
Versions: 1
Compression:
Stored size: 751 Bytes
Contents
module Firstfm class User include HTTParty base_uri 'ws.audioscrobbler.com' format :xml def self.get_top_artists(user, period = "overall", page = 1, limit = 50) response = get("/2.0/", {query: {method: 'user.getTopArtists', user: user, period: period, page: page, limit: limit, api_key: Firstfm.config.api_key}}) artists_array = (response and response["lfm"] and response["lfm"]["topartists"] and response["lfm"]["topartists"]["artist"]) || [] artists = Artist.init_from_array(artists_array) WillPaginate::Collection.create(page, limit) do |pager| pager.replace artists pager.total_entries = response['lfm']['topartists']['total'].to_i rescue 0 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
firstfm-0.7.0 | lib/firstfm/user.rb |