Module: Shortwave::Facade
- Defined in:
- lib/shortwave/facade/remote.rb,
lib/shortwave/facade/lastfm.rb,
lib/shortwave/facade/build/facade_builder.rb
Overview
Includes thin wrapper classes around the Last.fm web services API.
These classes map one-to-one to the Last.fm API, and are in fact generated from the HTML documentation the Last.fm provide. They make no attempt to OOify or XMLify the responses - the results of these methods are just the string responses from Last.fm. As such, they are a suitable base for building a “real” API on top of, which is what classes in Shortwave::Model do.
The general use is:
# Create a session for your platform
session = Shortwave::Authentication::Mobile.new("api_key", "app_secret")
# Authenticate if necessary (if you want to use write methods)
session.authenticate("user", "password")
# Create a facade, passing in the session
facade = Shortwave::Facade::Artist.new(session)
# Call methods on the facade
facade.("The feelies")
# => returns <lfm status="ok"> ... etc.
Required method parameters in the web api are real method parameters - if the method has optional parameters, these appear in an options hash after all the required parameters. You do not need to provide any authentication parameters (api_key
, api_sig
& sk
) - these are merged in from the session for you automatically.
If the request fails, the facade method will raise a RemoteError.
Each of the facades has further documentation, taken directly from the Last.fm documentation at last.fm/api
Defined Under Namespace
Modules: Build Classes: Album, Artist, Auth, Event, Geo, Group, Library, Playlist, Radio, Remote, RemoteError, Tag, Tasteometer, Track, User, Venue