SocialFolders Releases SoundCloud Ruby Gem

There are many approaches to building libraries that wrap HTTP APIs. For many of our officially supported SDKs we chose to build light wrappers around HTTP client libraries with a few added features to make it easier to work with the SoundCloud API. This approach has a few benefits. It guarantees a certain consistency and is relatively easy to maintain. It’s also fairly future proof. Changes in the HTTP API do not typically require updates to client libraries.

Sometimes however, you might be looking for something a bit more feature-full, or with more abstraction from our HTTP API. That’s why I was really happy to see that the great folks at SocialFolders built an alternative SoundCloud Ruby gem and released it to the public. You can check out their blog post about it or go straight to the source on GitHub.

You can install the library from source or by running:

$ gem install soundcloud-client

The library is based on the excellent Faraday HTTP client library and can therefore be used really easily with libraries like EventMachine or Typhoeus. It also provides wrapper methods for all SoundCloud API endpoints. This means that instead of calling a method named for an HTTP verb and providing an endpoint path, you can write code that looks like this:

require 'soundcloud-client'

client = Soundcloud::API.new('ACCESS_TOKEN')
tracks = client.tracks(:order => 'hotness', :limit => 10)
tracks.each do |track|
  puts "Track: #{track.title}"
end

It’s great to see tools like this coming out of our developer community. Huge shout out to Saverio Trioni and the rest of the SocialFolders team.