Project

rdio_api

0.04
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Rdio API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.4.5
~> 0.9
~> 2.6
~> 1.6

Runtime

~> 0.8.0
~> 1.2.0
~> 1.3.0
~> 0.1.5
 Project Readme

Rdio

Ruby wrapper for the Rdio API. Inspired by Linkedin gem & Twitter gem.

Installation

gem install rdio_api

Usage

Register for developer keys at http://developer.rdio.com/.

All the methods are exactly as in the API docs, camel cased and all the endpoints are also exactly the same.

OAuth flow is not part of this gem. Recommend using OmniAuth. Also check Rdio OAuth documentation.

Usage Examples

require "rubygems"
require "rdio_api"

# Initialize a new Rdio client
client = RdioApi.new(:consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET)

# Get songs in heavy rotation
client.getHeavyRotation(:type => "albums")

# Get top playlists
client.getTopCharts(:type => "Playlist")

# Search for a query and and pass in the type
client.search(:query => "michael giacchino", :types => "album")

# Get activity stream of a user
client.getActivityStream(:user => "s12345", :scope => "user")

# Find a user by email address
client.findUser(:email => "email@example.com")

# Methods that act on behalf of a user require an access token, OmniAuth is best for this

# Access token can be set at initialization
client = RdioApi.new(:consumer_key => CONSUMER_KEY,
					 :consumer_secret => CONSUMER_SECRET,
					 :access_token => ACCESS_TOKEN,
					 :access_secret => ACCESS_SECRET)

Access token and access secret can be set using the client access_token and

access_secret instance variables

client.access_token = ACCESS_TOKEN
client.access_secret = ACCESS_SECRET

# Get info about the current user
client.currentUser

# Add a friend
client.addFriend(:user => "s12345")

# Create a Playlist
client.createPlaylist(:name => "RubyGem",
                      :description => "Testing",
                      :tracks => "t1945474, t3483614")

Available Methods

# Unauthenticated methods, which only require registering for developer keys
client.get
client.getObjectFromShortCode
client.getObjectFromUrl
client.getAlbumsForArtist
client.getTracksForArtist
client.search
client.searchSuggestions
client.getAlbumsForArtistInCollection
client.getAlbumsInCollection
client.getArtistsInCollection
client.getTracksForAlbumInCollection
client.getTracksForArtistInCollection
client.getTracksInCollection
client.findUser
client.userFollowers
client.userFollowing
client.getActivityStream
client.getHeavyRotation
client.getNewReleases
client.getTopCharts
client.getPlaybackToken

# Authenticated methods, which require an access token , obtained with user permission
client.addToCollection
client.removeFromCollection
client.setAvailableOffline
client.addToPlaylist
client.createPlaylist
client.deletePlaylist
client.getPlaylists
client.removeFromPlaylist
client.setPlaylistCollaborating
client.setPlaylistCollaborationMode
client.setPlaylistFields
client.setPlaylistOrder
client.addFriend
client.currentUser
client.removeFriend

TODO

  • Explore moving methods from camel case to snake case and update tests accordingly
  • OAuth flow
  • More tests for methods and for each endpoints
  • Test and Support multiple Rubies