Sha256: cfa21c04292d1c52993a9fe6c0414dabc9b2c0daebebd4088f6d20d5887036a4

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

class Lastfm
  module MethodCategory
    class User < Base
      regular_method :get_info, [:user], [] do |response|
        response.xml['user'][0]
      end

      regular_method :get_friends, [:user], [[:recenttracks, nil], [:limit, nil], [:page, nil]] do |response|
        response.xml['friends']['user']
      end
      
      regular_method :get_neighbours, [:user], [[:recenttracks, nil], [:limit, nil], [:page, nil]] do |response|
        neighbours = response.xml['neighbours']['user']
        #ignore first "user" as this is an attribute, not an object
        neighbours.delete_at(0) if neighbours[0].is_a? String
        neighbours
      end

      regular_method :get_recent_tracks, [:user], [[:limit, nil], [:page, nil], [:to, nil], [:from, nil]] do |response|
        response.xml['recenttracks']['track']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lastfm-0.6.0 lib/lastfm/method_category/user.rb
lastfm-0.5.0 lib/lastfm/method_category/user.rb
lastfm-0.4.0 lib/lastfm/method_category/user.rb