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.
421 422 423 |
# File 'lib/rdio/types.rb', line 421 def initialize(api) super api end |
Instance Attribute Details
#is_subscriber ⇒ Object
isSubscriber
429 430 431 |
# File 'lib/rdio/types.rb', line 429 def is_subscriber @is_subscriber end |
#is_trial ⇒ Object
isTrial
426 427 428 |
# File 'lib/rdio/types.rb', line 426 def is_trial @is_trial end |
#is_unlimited ⇒ Object
isUnlimited
432 433 434 |
# File 'lib/rdio/types.rb', line 432 def is_unlimited @is_unlimited end |
Class Method Details
.add_friend(user) ⇒ Object
Add a friend to the current user.
525 526 527 |
# File 'lib/rdio/types.rb', line 525 def self.add_friend(user) Rdio::api.addFriend user end |
.add_playlists_to_collection(playlists) ⇒ Object
Add playlists to the current user’s collection.
560 561 562 |
# File 'lib/rdio/types.rb', line 560 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.
550 551 552 |
# File 'lib/rdio/types.rb', line 550 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.
555 556 557 |
# File 'lib/rdio/types.rb', line 555 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.
482 483 484 |
# File 'lib/rdio/types.rb', line 482 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.
462 463 464 |
# File 'lib/rdio/types.rb', line 462 def self.current(extras=nil) Rdio::api.currentUser extras end |
.find(s) ⇒ Object
Finds the user by email or vanity name
477 478 479 |
# File 'lib/rdio/types.rb', line 477 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.
467 468 469 |
# File 'lib/rdio/types.rb', line 467 def self.find_by_email(email) Rdio::api.findUserByEmail email end |
.find_by_vanity_name(name) ⇒ Object
Find a user either by email address.
472 473 474 |
# File 'lib/rdio/types.rb', line 472 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.
584 585 586 |
# File 'lib/rdio/types.rb', line 584 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.
590 591 592 |
# File 'lib/rdio/types.rb', line 590 def self.from_url(url) Rdio::api.getObjectFromUrl url,User end |
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type User.
487 488 489 490 |
# File 'lib/rdio/types.rb', line 487 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.
595 596 597 |
# File 'lib/rdio/types.rb', line 595 def self.playlists(extras=nil) Rdio::api.getPlaylists extras end |
.remove_friend(user) ⇒ Object
Remove a friend from the current user.
530 531 532 |
# File 'lib/rdio/types.rb', line 530 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.
535 536 537 |
# File 'lib/rdio/types.rb', line 535 def self.remove_from_collection(objs) Rdio::api.removeFromCollection objs end |
.remove_playlists_from_collection(playlists) ⇒ Object
Remove playlistsfrom the current user’s collection.
545 546 547 |
# File 'lib/rdio/types.rb', line 545 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.
540 541 542 |
# File 'lib/rdio/types.rb', line 540 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
456 457 458 459 |
# File 'lib/rdio/types.rb', line 456 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.
451 452 453 |
# File 'lib/rdio/types.rb', line 451 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.
498 499 500 |
# File 'lib/rdio/types.rb', line 498 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.
578 579 580 |
# File 'lib/rdio/types.rb', line 578 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.
493 494 495 |
# File 'lib/rdio/types.rb', line 493 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.
572 573 574 |
# File 'lib/rdio/types.rb', line 572 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.
503 504 505 506 |
# File 'lib/rdio/types.rb', line 503 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.
566 567 568 |
# File 'lib/rdio/types.rb', line 566 def heavy_rotation(friends=nil,limit=nil,extras=nil) api.getHeavyRotation self,nil,friends,limit,extras end |
#subscriber? ⇒ Boolean
isSubscriber
440 441 442 |
# File 'lib/rdio/types.rb', line 440 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.
520 521 522 |
# File 'lib/rdio/types.rb', line 520 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.
509 510 511 |
# File 'lib/rdio/types.rb', line 509 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.
514 515 516 517 |
# File 'lib/rdio/types.rb', line 514 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
445 446 447 |
# File 'lib/rdio/types.rb', line 445 def unlimited? is_unlimited end |