Class: Shortwave::Facade::User

Inherits:
Remote
  • Object
show all
Defined in:
lib/shortwave/facade/lastfm.rb

Instance Attribute Summary

Attributes inherited from Remote

#session

Instance Method Summary collapse

Methods inherited from Remote

#initialize

Constructor Details

This class inherits a constructor from Shortwave::Facade::Remote

Instance Method Details

#events(user) ⇒ Object

Get a list of upcoming events that this user is attending. Easily integratable into calendars, using the ical standard (see ‘more formats’ section below).

user

The user to fetch the events for.



157
158
159
# File 'lib/shortwave/facade/lastfm.rb', line 157

def events(user)
  get(:standard, {:method => "user.getEvents", :user => user})
end

#friends(user, options = {}) ⇒ Object

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

user

The last.fm username to fetch the friends of.

Options

recenttracks

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

limit

An integer used to limit the number of friends returned per page. The default is 50.

page

The page number to fetch.



203
204
205
# File 'lib/shortwave/facade/lastfm.rb', line 203

def friends(user, options={})
  get(:standard, {:method => "user.getFriends", :user => user}.merge(options))
end

#infoObject

Get information about a user profile.



172
173
174
# File 'lib/shortwave/facade/lastfm.rb', line 172

def info()
  get(:session, {:method => "user.getInfo"})
end

#loved_tracks(user) ⇒ Object

Get the last 50 tracks loved by a user.

user

The user name to fetch the loved tracks for.



122
123
124
# File 'lib/shortwave/facade/lastfm.rb', line 122

def loved_tracks(user)
  get(:standard, {:method => "user.getLovedTracks", :user => user})
end

#neighbours(user, options = {}) ⇒ Object

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

user

The last.fm username to fetch the neighbours of.

Options

limit

An integer used to limit the number of neighbours returned.



132
133
134
# File 'lib/shortwave/facade/lastfm.rb', line 132

def neighbours(user, options={})
  get(:standard, {:method => "user.getNeighbours", :user => user}.merge(options))
end

#past_events(user, options = {}) ⇒ Object

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

user

The username to fetch the events for.

Options

page

The page number to scan to.

limit

The number of events to return per page.



250
251
252
# File 'lib/shortwave/facade/lastfm.rb', line 250

def past_events(user, options={})
  get(:standard, {:method => "user.getPastEvents", :user => user}.merge(options))
end

#playlists(user) ⇒ Object

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

user

The last.fm username to fetch the playlists of.



239
240
241
# File 'lib/shortwave/facade/lastfm.rb', line 239

def playlists(user)
  get(:standard, {:method => "user.getPlaylists", :user => user})
end

#recent_tracks(user, options = {}) ⇒ Object

Get a list of the recent tracks listened to by this user. Indicates now playing track if the user is currently listening.

user

The last.fm username to fetch the recent tracks of.

Options

limit

An integer used to limit the number of tracks returned.



142
143
144
# File 'lib/shortwave/facade/lastfm.rb', line 142

def recent_tracks(user, options={})
  get(:standard, {:method => "user.getRecentTracks", :user => user}.merge(options))
end

Get Last.fm artist recommendations for a user



255
256
257
# File 'lib/shortwave/facade/lastfm.rb', line 255

def recommended_artists()
  get(:session, {:method => "user.getRecommendedArtists"})
end

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

Options

page

The page number to scan to.

limit

The number of events to return per page.



181
182
183
# File 'lib/shortwave/facade/lastfm.rb', line 181

def recommended_events(options={})
  get(:session, {:method => "user.getRecommendedEvents"}.merge(options))
end

#shout(user, message) ⇒ Object

Shout on this user’s shoutbox

user

The name of the user to shout on.

message

The message to post to the shoutbox.



150
151
152
# File 'lib/shortwave/facade/lastfm.rb', line 150

def shout(user, message)
  post(:session, {:method => "user.shout", :user => user, :message => message})
end

#shouts(user) ⇒ Object

Get shouts for this user. Also available as an rss feed.

user

The username to fetch shouts for



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

def shouts(user)
  get(:standard, {:method => "user.getShouts", :user => user})
end

#top_albums(user, options = {}) ⇒ Object

Get the top albums listened to by a user. You can stipulate a time period. Sends the overall chart by default.

user

The user name to fetch top albums for.

Options

period

overall | 3month | 6month | 12month - The time period over which to retrieve top albums for.



265
266
267
# File 'lib/shortwave/facade/lastfm.rb', line 265

def top_albums(user, options={})
  get(:standard, {:method => "user.getTopAlbums", :user => user}.merge(options))
end

#top_artists(user, options = {}) ⇒ Object

Get the top artists listened to by a user. You can stipulate a time period. Sends the overall chart by default.

user

The user name to fetch top artists for.

Options

period

overall | 3month | 6month | 12month - The time period over which to retrieve top artists for.



191
192
193
# File 'lib/shortwave/facade/lastfm.rb', line 191

def top_artists(user, options={})
  get(:standard, {:method => "user.getTopArtists", :user => user}.merge(options))
end

#top_tags(user, options = {}) ⇒ Object

Get the top tags used by this user.

user

The user name

Options

limit

Limit the number of tags returned



282
283
284
# File 'lib/shortwave/facade/lastfm.rb', line 282

def top_tags(user, options={})
  get(:standard, {:method => "user.getTopTags", :user => user}.merge(options))
end

#top_tracks(user, options = {}) ⇒ Object

Get the top tracks listened to by a user. You can stipulate a time period. Sends the overall chart by default.

user

The user name to fetch top tracks for.

Options

period

overall | 3month | 6month | 12month - The time period over which to retrieve top tracks for.



167
168
169
# File 'lib/shortwave/facade/lastfm.rb', line 167

def top_tracks(user, options={})
  get(:standard, {:method => "user.getTopTracks", :user => user}.merge(options))
end

#weekly_album_chart(user, options = {}) ⇒ Object

Get an album chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent album chart for this user.

user

The last.fm username to fetch the charts of.

Options

from

The date at which the chart should start from. See User.getChartsList for more.

to

The date at which the chart should end on. See User.getChartsList for more.



221
222
223
# File 'lib/shortwave/facade/lastfm.rb', line 221

def weekly_album_chart(user, options={})
  get(:standard, {:method => "user.getWeeklyAlbumChart", :user => user}.merge(options))
end

#weekly_artist_chart(user, options = {}) ⇒ Object

Get an artist chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent artist chart for this user.

user

The last.fm username to fetch the charts of.

Options

from

The date at which the chart should start from. See User.getWeeklyChartList for more.

to

The date at which the chart should end on. See User.getWeeklyChartList for more.



232
233
234
# File 'lib/shortwave/facade/lastfm.rb', line 232

def weekly_artist_chart(user, options={})
  get(:standard, {:method => "user.getWeeklyArtistChart", :user => user}.merge(options))
end

#weekly_chart_list(user) ⇒ Object

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

user

The last.fm username to fetch the charts list for.



272
273
274
# File 'lib/shortwave/facade/lastfm.rb', line 272

def weekly_chart_list(user)
  get(:standard, {:method => "user.getWeeklyChartList", :user => user})
end

#weekly_track_chart(user, options = {}) ⇒ Object

Get a track chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent track chart for this user.

user

The last.fm username to fetch the charts of.

Options

from

The date at which the chart should start from. See User.getWeeklyChartList for more.

to

The date at which the chart should end on. See User.getWeeklyChartList for more.



293
294
295
# File 'lib/shortwave/facade/lastfm.rb', line 293

def weekly_track_chart(user, options={})
  get(:standard, {:method => "user.getWeeklyTrackChart", :user => user}.merge(options))
end