Class: Rdio::User
Overview
Represents an Rdio user
Instance Attribute Summary collapse
-
#is_subscriber ⇒ Object
isSubscriber.
-
#is_trial ⇒ Object
isTrial.
-
#is_unlimited ⇒ Object
isUnlimited.
Attributes inherited from UserData
#base_icon, #display_name, #first_name, #gender, #icon, #last_name, #last_song_play_time, #last_song_played, #library_version, #track_count, #type, #url, #username
Attributes inherited from BaseObj
Attributes inherited from ApiObj
Class Method Summary collapse
-
.add_friend(user) ⇒ Object
Add a friend to the current user.
-
.add_playlists_to_collection(playlists) ⇒ Object
Add playlists to the current user’s collection.
-
.add_to_collection(objs) ⇒ Object
Add tracks or playlists to the current user’s collection.
-
.add_tracks_to_collection(tracks) ⇒ Object
Add tracks to the current user’s collection.
-
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type User.
-
.current(extras = nil) ⇒ Object
Get information about the currently logged in user.
-
.find(s) ⇒ Object
Finds the user by email or vanity name.
-
.find_by_email(email) ⇒ Object
Find a user either by email address.
-
.find_by_vanity_name(name) ⇒ Object
Find a user either by email address.
-
.from_short_code(short_code) ⇒ Object
Return the User that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
-
.from_url(url) ⇒ Object
Return the User that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.
-
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type User.
-
.playlists(extras = nil) ⇒ Object
Get the current user’s playlists.
-
.remove_friend(user) ⇒ Object
Remove a friend from the current user.
-
.remove_from_collection(objs) ⇒ Object
Remove tracks or playlists from the current user’s collection.
-
.remove_playlists_from_collection(playlists) ⇒ Object
Remove playlistsfrom the current user’s collection.
-
.remove_tracks_from_collection(tracks) ⇒ Object
Remove tracks from the current user’s collection.
-
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of User for the query and other params.
-
.top_charts ⇒ Object
Return the site-wide most popular items for Users.
Instance Method Summary collapse
-
#activity_stream(scope = 'user', last_id = nil) ⇒ Object
Get the activity events for a user, a user’s friends, or everyone on Rdio.
-
#albums_for_artist_in_collection(artist) ⇒ Object
Get the albums in the user’s collection by a particular artist.
-
#albums_heavy_rotation(friends = nil, limit = nil) ⇒ Object
Find the most popular albums for a user, their friends or the whole site.
-
#albums_in_collection(start = nil, count = nil, sort = nil, query = nil) ⇒ Object
Get all of the albums in the user’s collection.
-
#artists_heavy_rotation(friends = nil, limit = nil) ⇒ Object
Find the most popular artists for a user, their friends or the whole site.
-
#artists_in_collection(start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the artist in a user’s collection.
-
#heavy_rotation(friends = nil, limit = nil, extras = nil) ⇒ Object
Find the most popular artists or albums for a user, their friends or the whole site.
-
#initialize(api) ⇒ User
constructor
A new instance of User.
-
#subscriber? ⇒ Boolean
isSubscriber.
-
#tracks_for_album_in_collection(album, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
-
#tracks_for_artist_in_collection(artist, extras = nil) ⇒ Object
Which tracks from the given artist are in the user’s collection.
-
#tracks_in_collection(start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the tracks in the user’s collection.
-
#trial? ⇒ Boolean
isTrial.
-
#unlimited? ⇒ Boolean
isUnlimited.
Methods inherited from BaseObj
Methods inherited from ApiObj
Constructor Details
#initialize(api) ⇒ User
Returns a new instance of User.
428 429 430 |
# File 'lib/rdio/types.rb', line 428 def initialize(api) super api end |
Instance Attribute Details
#is_subscriber ⇒ Object
isSubscriber
436 437 438 |
# File 'lib/rdio/types.rb', line 436 def is_subscriber @is_subscriber end |
#is_trial ⇒ Object
isTrial
433 434 435 |
# File 'lib/rdio/types.rb', line 433 def is_trial @is_trial end |
#is_unlimited ⇒ Object
isUnlimited
439 440 441 |
# File 'lib/rdio/types.rb', line 439 def is_unlimited @is_unlimited end |
Class Method Details
.add_friend(user) ⇒ Object
Add a friend to the current user.
532 533 534 |
# File 'lib/rdio/types.rb', line 532 def self.add_friend(user) Rdio::api.addFriend user end |
.add_playlists_to_collection(playlists) ⇒ Object
Add playlists to the current user’s collection.
567 568 569 |
# File 'lib/rdio/types.rb', line 567 def self.add_playlists_to_collection(playlists) add_to_collection playlists end |
.add_to_collection(objs) ⇒ Object
Add tracks or playlists to the current user’s collection.
557 558 559 |
# File 'lib/rdio/types.rb', line 557 def self.add_to_collection(objs) Rdio::api.addToCollection objs end |
.add_tracks_to_collection(tracks) ⇒ Object
Add tracks to the current user’s collection.
562 563 564 |
# File 'lib/rdio/types.rb', line 562 def self.add_tracks_to_collection(tracks) add_to_collection tracks end |
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type User.
489 490 491 |
# File 'lib/rdio/types.rb', line 489 def self.all(keys,extras=nil) Rdio::api.get keys,User,extras end |
.current(extras = nil) ⇒ Object
Get information about the currently logged in user.
469 470 471 |
# File 'lib/rdio/types.rb', line 469 def self.current(extras=nil) Rdio::api.currentUser extras end |
.find(s) ⇒ Object
Finds the user by email or vanity name
484 485 486 |
# File 'lib/rdio/types.rb', line 484 def self.find(s) s =~ /@/ ? find_by_email(s) : find_by_vanity_name(s) end |
.find_by_email(email) ⇒ Object
Find a user either by email address.
474 475 476 |
# File 'lib/rdio/types.rb', line 474 def self.find_by_email(email) Rdio::api.findUserByEmail email end |
.find_by_vanity_name(name) ⇒ Object
Find a user either by email address.
479 480 481 |
# File 'lib/rdio/types.rb', line 479 def self.find_by_vanity_name(name) Rdio::api.findUserByVanityName name end |
.from_short_code(short_code) ⇒ Object
Return the User that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
591 592 593 |
# File 'lib/rdio/types.rb', line 591 def self.from_short_code(short_code) Rdio::api.getObjectFromShortCode short_code,User end |
.from_url(url) ⇒ Object
Return the User that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.
597 598 599 |
# File 'lib/rdio/types.rb', line 597 def self.from_url(url) Rdio::api.getObjectFromUrl url,User end |
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type User.
494 495 496 497 |
# File 'lib/rdio/types.rb', line 494 def self.get(key,extras=nil) arr = all [key],extras return (arr and not arr.empty?) ? arr[0] : nil end |
.playlists(extras = nil) ⇒ Object
Get the current user’s playlists.
602 603 604 |
# File 'lib/rdio/types.rb', line 602 def self.playlists(extras=nil) Rdio::api.getPlaylists extras end |
.remove_friend(user) ⇒ Object
Remove a friend from the current user.
537 538 539 |
# File 'lib/rdio/types.rb', line 537 def self.remove_friend(user) Rdio::api.removeFriend user end |
.remove_from_collection(objs) ⇒ Object
Remove tracks or playlists from the current user’s collection.
542 543 544 |
# File 'lib/rdio/types.rb', line 542 def self.remove_from_collection(objs) Rdio::api.removeFromCollection objs end |
.remove_playlists_from_collection(playlists) ⇒ Object
Remove playlistsfrom the current user’s collection.
552 553 554 |
# File 'lib/rdio/types.rb', line 552 def self.remove_playlists_from_collection(playlists) remove_from_collection playlists end |
.remove_tracks_from_collection(tracks) ⇒ Object
Remove tracks from the current user’s collection.
547 548 549 |
# File 'lib/rdio/types.rb', line 547 def self.remove_tracks_from_collection(tracks) remove_from_collection tracks end |
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of User for the query and other params
463 464 465 466 |
# File 'lib/rdio/types.rb', line 463 def self.search(query,never_or=nil,extras=nil,start=nil,count=nil) extras = Rdio::add_to_array extras,'users' Search.search query,User,never_or,extras,start,count end |
Instance Method Details
#activity_stream(scope = 'user', last_id = nil) ⇒ Object
Get the activity events for a user, a user’s friends, or everyone on Rdio.
458 459 460 |
# File 'lib/rdio/types.rb', line 458 def activity_stream(scope='user',last_id=nil) api.getActivityStream self,scope,last_id end |
#albums_for_artist_in_collection(artist) ⇒ Object
Get the albums in the user’s collection by a particular artist.
505 506 507 |
# File 'lib/rdio/types.rb', line 505 def albums_for_artist_in_collection(artist) api.getAlbumsForArtistInCollection artist,self end |
#albums_heavy_rotation(friends = nil, limit = nil) ⇒ Object
Find the most popular albums for a user, their friends or the whole site.
585 586 587 |
# File 'lib/rdio/types.rb', line 585 def albums_heavy_rotation(friends=nil,limit=nil) api.getHeavyRotation self,Album,friends,limit end |
#albums_in_collection(start = nil, count = nil, sort = nil, query = nil) ⇒ Object
Get all of the albums in the user’s collection.
500 501 502 |
# File 'lib/rdio/types.rb', line 500 def albums_in_collection(start=nil,count=nil,sort=nil,query=nil) api.getAlbumsInCollection self,start,count,sort,query end |
#artists_heavy_rotation(friends = nil, limit = nil) ⇒ Object
Find the most popular artists for a user, their friends or the whole site.
579 580 581 |
# File 'lib/rdio/types.rb', line 579 def artists_heavy_rotation(friends=nil,limit=nil) api.getHeavyRotation self,Artist,friends,limit end |
#artists_in_collection(start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the artist in a user’s collection.
510 511 512 513 |
# File 'lib/rdio/types.rb', line 510 def artists_in_collection(start=nil,count=nil,sort=nil, query=nil,extras=nil) api.getArtistsInCollection self,start,count,sort,query,extras end |
#heavy_rotation(friends = nil, limit = nil, extras = nil) ⇒ Object
Find the most popular artists or albums for a user, their friends or the whole site.
573 574 575 |
# File 'lib/rdio/types.rb', line 573 def heavy_rotation(friends=nil,limit=nil,extras=nil) api.getHeavyRotation self,nil,friends,limit,extras end |
#subscriber? ⇒ Boolean
isSubscriber
447 448 449 |
# File 'lib/rdio/types.rb', line 447 def subscriber? is_subscriber end |
#tracks_for_album_in_collection(album, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
527 528 529 |
# File 'lib/rdio/types.rb', line 527 def tracks_for_album_in_collection(album,extras=nil) api.getTracksForAlbumInCollection album,self,extras end |
#tracks_for_artist_in_collection(artist, extras = nil) ⇒ Object
Which tracks from the given artist are in the user’s collection.
516 517 518 |
# File 'lib/rdio/types.rb', line 516 def tracks_for_artist_in_collection(artist,extras=nil) api.getTracksForArtistInCollection artist,self,extras end |
#tracks_in_collection(start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the tracks in the user’s collection.
521 522 523 524 |
# File 'lib/rdio/types.rb', line 521 def tracks_in_collection(start=nil,count=nil,sort=nil, query=nil,extras=nil) api.getTracksInCollection self,start,count,sort,query,extras end |
#unlimited? ⇒ Boolean
isUnlimited
452 453 454 |
# File 'lib/rdio/types.rb', line 452 def unlimited? is_unlimited end |