Sha256: af3e73cb8641ef637f6c5dedd4dcba84ffc0640a019d5e73b8889601af5366f7

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 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-1.1.1 lib/lastfm/method_category/user.rb
lastfm-1.1.0 lib/lastfm/method_category/user.rb
lastfm-1.0.1 lib/lastfm/method_category/user.rb