Class MusicBrainz::Webservice::Webservice
In: lib/rbrainz/webservice/webservice.rb
Parent: IWebservice

An interface to the MusicBrainz XML web service via HTTP.

By default, this class uses the MusicBrainz server but may be configured for accessing other servers as well using the constructor. This implements IWebService, so additional documentation on method parameters can be found there.

Methods

get   new   post  

Attributes

open_timeout  [RW]  Timeouts for opening and reading connections (in seconds)
read_timeout  [RW]  Timeouts for opening and reading connections (in seconds)

Public Class methods

If no options are given the default MusicBrainz webservice will be used. User authentication with username and password is only needed for some services. If you want to query an alternative webservice you can do so by setting the appropriate options.

Available options:

:host
Host, defaults to ‘musicbrainz.org’.
:port
Port, defaults to 80.
:path_prefix
The path prefix under which the webservice is located on the server. Defaults to ’/ws’.
:username
The username to authenticate with.
:password
The password to authenticate with.
:user_agent
Value sent in the User-Agent HTTP header. Defaults to "rbrainz/#{RBRAINZ_VERSION}"
:proxy
URI for the proxy server to connect through

Public Instance methods

Query the Webservice with HTTP GET.

Returns an IO object on success.

Options:

:id
A MBID if querying for a single ressource.
:include
An include object (see AbstractIncludes).
:filter
A filter object (see AbstractFilter).
:version
The version of the webservice to use. Defaults to 1.
Raises:RequestError, ResourceNotFoundError, AuthenticationError, ConnectionError
See:IWebservice#get

Send data to the web service via HTTP-POST.

Note that this may require authentication. You can set user name, password and realm in the constructor.

Returns an IO object on success.

Options:

:id
A MBID if querying for a single ressource.
:params
A Hash or Array containing the data to post as key/value pairs.
:version
The version of the webservice to use. Defaults to 1.
Raises:ConnectionError, RequestError, AuthenticationError, ResourceNotFoundError
See:IWebservice#post

[Validate]