Class: LastFM::Api::User

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

Class Method Summary collapse

Class Method Details

.get_artist_tracks(params) ⇒ Object

Get a list of tracks by a given artist scrobbled by this user, including scrobble time. Can be limited to specific timeranges, defaults to all time.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username to fetch the recent tracks for

  • :artist (String, required)

    the artist name to fetch tracks for

  • :startTimestamp (Time, optional)

    a unix timestamp to start at

  • :endTimestamp (Time, optional)

    a unix timestamp to end at

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

See Also:



16
17
18
# File 'lib/lastfm/api/user.rb', line 16

def get_artist_tracks( params )
  LastFM.get( "user.getArtistTracks", params )
end

.get_banned_tracks(params) ⇒ Object

Get a list of tracks banned by a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



26
27
28
# File 'lib/lastfm/api/user.rb', line 26

def get_banned_tracks( params )
  LastFM.get( "user.getBannedTracks", params )
end

.get_events(params) ⇒ Object

Get a list of upcoming events that this user is attending.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :festivalsonly (Boolean, optional)

    whether only festivals should be returned, or all events

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



37
38
39
# File 'lib/lastfm/api/user.rb', line 37

def get_events( params )
  LastFM.get( "user.getEvents", params )
end

.get_friends(params) ⇒ Object

Get a list of the user’s friends on Last.fm.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :recenttracks (Boolean, optional)

    whether or not to include information about friends’ recent listening in the response.

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



48
49
50
# File 'lib/lastfm/api/user.rb', line 48

def get_friends( params )
  LastFM.get( "user.getFriends", params )
end

.get_info(params) ⇒ Object

Get information about a user profile.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, optional)

    user to fetch info for. defaults to the authenticated user

See Also:



56
57
58
# File 'lib/lastfm/api/user.rb', line 56

def get_info( params )
  LastFM.get( "user.getInfo", params )
end

.get_loved_tracks(params) ⇒ Object

Get a list of tracks loved by a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



66
67
68
# File 'lib/lastfm/api/user.rb', line 66

def get_loved_tracks( params )
  LastFM.get( "user.getLovedTracks", params )
end

.get_neighbors(params) ⇒ Object

Get a list of a user’s neighbours on Last.fm.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



75
76
77
# File 'lib/lastfm/api/user.rb', line 75

def get_neighbors( params )
  LastFM.get( "user.getNeighbonrs", params )
end

.get_new_releases(params) ⇒ Object

Gets a list of upcoming releases based on a user’s musical taste.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :userecs (Boolean, optional)

    if true, return new releases based on artist recommendations. otherwise, it is based on their library (the default)

See Also:



84
85
86
# File 'lib/lastfm/api/user.rb', line 84

def get_new_releases( params )
  LastFM.get( "user.getNewReleases", params )
end

.get_past_events(params) ⇒ Object

Get a list of all events a user has attended in the past.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



94
95
96
# File 'lib/lastfm/api/user.rb', line 94

def get_past_events( params )
  LastFM.get( "user.getPastEvents", params )
end

.get_personal_tags(params) ⇒ Object

Get the user’s personal tags.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :tag (String, required)

    the tag you’re interested in

  • :taggingtype (String, required)

    the type of items which have been tagged. accepted types are ‘artist’, ‘album’, or ‘track’

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



106
107
108
# File 'lib/lastfm/api/user.rb', line 106

def get_personal_tags( params )
  LastFM.get( "user.getPersonalTags", params )
end

.get_playlists(params) ⇒ Object

Get a list of a user’s playlists.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

See Also:



114
115
116
# File 'lib/lastfm/api/user.rb', line 114

def get_playlists( params )
  LastFM.get( "user.getPlaylists", params )
end

.get_recent_stations(params) ⇒ Object

Get a list of the recent Stations listened to by a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



124
125
126
127
# File 'lib/lastfm/api/user.rb', line 124

def get_recent_stations( params )
  LastFM.requires_authentication
  LastFM.get( "user.getRecentStations", params, :secure )
end

.get_recent_tracks(params) ⇒ Object

Get a list of the recent tracks listened to by a user. Also includes the currently playing track with the nowplaying=“true” attribute if the user is currently listening.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :from (Time, optional)

    display scrobbles after this time, formatted as unix UTC integer timestamp

  • :to (Time, optional)

    display scrobbles before this time, formatted as unix UTC integer timestamp

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



139
140
141
# File 'lib/lastfm/api/user.rb', line 139

def get_recent_tracks( params )
  LastFM.get( "user.getRecentTracks", params )
end

Get Last.fm artist recommendations for a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



148
149
150
151
# File 'lib/lastfm/api/user.rb', line 148

def get_recommended_artists( params )
  LastFM.requires_authentication
  LastFM.get( "user.getRecommendedArtists", params, :secure )
end

Get a paginated list of all events recommended to a user by Last.fm, based on their listening profile.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



158
159
160
161
# File 'lib/lastfm/api/user.rb', line 158

def get_recommended_events( params )
  LastFM.requires_authentication
  LastFM.get( "user.getRecommendedEvents", params, :secure )
end

.get_shouts(params) ⇒ Object

Get shouts for a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



169
170
171
# File 'lib/lastfm/api/user.rb', line 169

def get_shouts( params )
  LastFM.get( "user.getShouts", params, :secure )
end

.get_top_albums(params) ⇒ Object

Get the top albums listened to by a user, based on an optional time period.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :period (String, optional)

    time period over which to retrieve top albums for. accepted values are ‘overall’, ‘7day’, ‘3month’, ‘6month’ or ‘12month’

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



180
181
182
# File 'lib/lastfm/api/user.rb', line 180

def get_top_albums( params )
  LastFM.get( "user.getTopAlbums", params )
end

.get_top_artists(params) ⇒ Object

Get the top artists listened to by a user, based on an optional time period.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :period (String, optional)

    time period over which to retrieve top artists for. accepted values are ‘overall’, ‘7day’, ‘3month’, ‘6month’ or ‘12month’

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



191
192
193
# File 'lib/lastfm/api/user.rb', line 191

def get_top_artists( params )
  LastFM.get( "user.getTopArtists", params )
end

.get_top_tags(params) ⇒ Object

Get the top tags used by a user.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



200
201
202
# File 'lib/lastfm/api/user.rb', line 200

def get_top_tags( params )
  LastFM.get( "user.getTopTags", params )
end

.get_top_tracks(params) ⇒ Object

Get the top tracks listened to by a user, based on an optional time period.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :period (String, optional)

    time period over which to retrieve top tracks for. accepted values are ‘overall’, ‘7day’, ‘3month’, ‘6month’ or ‘12month’

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:



211
212
213
# File 'lib/lastfm/api/user.rb', line 211

def get_top_tracks( params )
  LastFM.get( "user.getTopTracks", params )
end

.get_weekly_album_chart(params) ⇒ Object

Get an album chart for a user, for a given date range. Defaults to the most recent chart.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :from (String, optional)

    date at which the chart should start. (see: User.get_weekly_chart_list)

  • :to (String, optional)

    date at which the chart should end. (see: User.get_weekly_chart_list)

See Also:



221
222
223
# File 'lib/lastfm/api/user.rb', line 221

def get_weekly_album_chart( params )
  LastFM.get( "user.getWeeklyAlbumChart", params )
end

.get_weekly_artist_chart(params) ⇒ Object

Get an artist chart for a user, for a given date range. Defaults to the most recent chart.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :from (String, optional)

    date at which the chart should start. (see: User.get_weekly_chart_list)

  • :to (String, optional)

    date at which the chart should end. (see: User.get_weekly_chart_list)

See Also:



231
232
233
# File 'lib/lastfm/api/user.rb', line 231

def get_weekly_artist_chart( params )
  LastFM.get( "user.getWeeklyArtistChart", params )
end

.get_weekly_chart_list(params) ⇒ Object

Get a list of available charts for this user, expressed as date ranges which can be sent to the chart services.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

See Also:



239
240
241
# File 'lib/lastfm/api/user.rb', line 239

def get_weekly_chart_list( params )
  LastFM.get( "user.getWeeklyChartList", params )
end

.get_weekly_track_chart(params) ⇒ Object

Get a track chart for a user, for a given date range. Defaults to the most recent chart.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    last.fm username

  • :from (String, optional)

    date at which the chart should start. (see: User.get_weekly_chart_list)

  • :to (String, optional)

    date at which the chart should end. (see: User.get_weekly_chart_list)

See Also:



249
250
251
# File 'lib/lastfm/api/user.rb', line 249

def get_weekly_track_chart( params )
  LastFM.get( "user.getWeeklyTrackChart", params )
end

.shout(params) ⇒ Object

Shout on a user’s shoutbox.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :user (String, required)

    user to shout on

  • :message (String, required)

    message to post to the shoutbox

See Also:



258
259
260
261
# File 'lib/lastfm/api/user.rb', line 258

def shout( params )
  LastFM.requires_authentication
  LastFM.post( "user.shout", params )
end