Class: LastFM::Tasteometer

Inherits:
Object
  • Object
show all
Defined in:
lib/lastfm/tasteometer.rb

Class Method Summary collapse

Class Method Details

.compare(params) ⇒ Object

Get a Tasteometer score from two inputs, along with a list of shared artists. If the input is a User some additional information is returned.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :types (Array, required)

    two types are required for comparison. accepted types are ‘user’ and ‘artists’

  • :values (Array, required)

    values for the corresponding types. accepted values are Last.fm usernames, or arrays of artist names (up to 100 artists)

  • :limit (Fixnum, optional)

    how many shared artists to display. default is 5

See Also:



12
13
14
15
16
# File 'lib/lastfm/tasteometer.rb', line 12

def compare( params )
  Array(params.delete(:types)).each_with_index{|val, i| params["type[#{i}]"] = val}
  Array(params.delete(:values)).each_with_index{|val, i| params["value[#{i}]"] = val}
  LastFM.get( "tasteometer.compare", params )
end

.compare_group(params) ⇒ Object

Deprecated.

This service has been deprecated and is no longer available

Get the scores between every user in a group of users, plus shared artists. Cuts off any similarities below a cutoff. Also returns a list of all users in the comparison and a small amount of metadata about each. Can take the list of users from a group, or a users friends.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :source (String, required)

    what source we’re using for the comparison. accepted sources are ‘user’ and ‘group’

  • :value (String, required)

    name of the source we’re using. should be either a Last.fm username or group name

  • :cutoff (Float, optional)

    the minimum level over which comparisons should be returned. default is 0.2

  • :connection_limit (Fixnum, optional)

    the maximum number of connections each user should have. default is 6

See Also:



29
30
31
# File 'lib/lastfm/tasteometer.rb', line 29

def compare_group(params)
  LastFM.get( "tasteometer.compareGroup", params )
end