Skip to content client for Ruby (and particularly Rails) based around ActiveResource
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


= Active


Active is a client wrapper around the [] [ 2.0 web-services] based around ActiveResource.

== Overview

This wrapper is really simple at the moment. 2.0's web-services provide an XML-RPC over XML/HTTP style interface to a load of interesting music and user information. ActiveResource is well tailored for purist RESTful interfaces but not for action-oriented services. This project basically overrides ActiveResource's URL creation for's static URL so that the developer can simply wrap ActiveResource's default methods to create their own models around action types.

== References

I really haven't done all that much myself here, here are a list of articles / projects that I've borrowed from:
 * link:
 * link:
 * link:
 * link:

== Usage

For example, if you wanted to use's music ontology to create an Artist model then you might set it up something like this:

	require 'active_lastfm'
	class Artist < ActiveLastfm
	  def search(artist)
	    search_result = self.find(:first, :params => {
	        :method => '',
	        :artist => artist,
	        :api_key => 'b25b959554ed76058ac220b7b2e0a026'

Now, obviously, that's fairly buggy, what with the lack of result checking and coercing, but you get the idea. The API key used is the one that have in their examples, so I'd suggest you go get your own one.

== Testing

The current unit tests use ActiveResource::HttpMock to have the mock service respond to requests and return cached results from, stored in 'test/fixtures/'. The current methods tested are:
 * artist.gettoptracks

These tests pass when run under Rake from a checked out copy, but they fail, horribly, when you test under gem (say with a: sudo gem install active_lastfm -t). Hopefully I'll get round to fixing that!

== ToDo

 * Proper documentation.
 * Set up a proper release process from link: to link:
 * Start working out / test all the ActiveResource methods other than 'find'.
 * Create re-usable models.
 * Make sure I remove the ActiveResource patches that I've had to use.

Something went wrong with that request. Please try again.