Two days ago I released my first Ruby gem. In coding parlance gems are software libraries created to enhance the Ruby programming language.
My gem is call glutton_lastfm. It’s a wrapper library for version 2.0 of the last.fm API. The source code and documentation is available on my github account.
This gem allows you to query last.fm for:
- artist information by name
- top albums by artist
- top tracks by artist
- top user-submitted tags by artist
- upcoming events by artist
- album information by name
For example, here’s a program that searches for tags and images related to Buck 65: artist_tags_and_images.rb
I wrote this library to:
- Learn the gem creation process. (Facilitated by the jeweler gem.)
- Better understand the mechanics of web-based APIs. (Facilitated by the httparty gem.)
- Brush up on my unit-testing skills. (Facilitated by the fakeweb gem.)
- Distance myself from years of return-code function creation in favour of exceptions.
I also wrote it as part of a larger data-mining project I’m working on. (Which reminds me that I’ve been meaning to write a post on datasets and the soon to explode dataset market.)
The glutton_lastfm source-code is released unlicensed into the public domain.