Class: LastFM::User

Inherits:
Object
  • Object
show all
Defined in:
lib/lastfm/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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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:


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

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