Last.fm API class
A Kohana3 module to interface with the last.fm API.
Obtains a singleton of the LastFM class
Determines if the class has a valid session id from last.fm. If this returns FALSE, you should use the authorize() method to get a valid token.
Obtains the session object for the class. Will contain NULL or an object containing the following properties:
- name - the last.fm username who is authenticated
- key - the api key. Used internally for write requests to the API
static authorize($redirect_url = NULL)
Sends the request to last.fm to authorize the session. Takes an optional parameter to send the request back to. Last.fm will default to your API location defined in your application.
Obtains an authorization session id. You should store this in a secure location (that means encrypted).
api($method, array $params = array())
Sends an api request to last.fm. Returns a json_decode()'d object of the result. Can throw an exception if an error occurs. This can happen if you don't supply required parameters for a method.
Currently, the configuration items are stored in the class itself. You should extend the class and set the $key and $secret properties. This may (that means probably) change later.