Class SpazTMDB

Defined in: spaztmdb.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
SpazTMDB(opts)

Method Summary
Method Attributes Method Name and Description
 
callMethod(opts)

a general purpose method for calling API methods via ajax and raising events on success/failure.

 

Gets the API key

 
getURL(method, value)

Method to construct an API URL from the passed method and value strings

 
movieImages(id, onSuccess, onFailure)

Get images for a movie

 
movieInfo(id, onSuccess, onFailure)

Get info for a movie

 
movieInfoHash(hash, onSuccess, onFailure)

Get movie info by file hash

 
movieInfoIMDB(id, onSuccess, onFailure)

Lookup a movie by IMDB id

 
movieSearch(value, onSuccess, onFailure)

Search for movies by title

 
personInfo(id, onSuccess, onFailure)

Search for a person

 
personSearch(name, onSuccess, onFailure)

Search for a person

 
setAPIKey(apikey)

Sets the API key

Class Detail

SpazTMDB(opts)

Parameters:
{Object} opts
{string} opts.apikey
the api key
{string} opts.lang Optional
a language code. default is 'en'
{string} opts.format Optional
the data format to return. default is 'json'
{DOMElement} opts.eventTarget Optional
what to target triggered events with. default is the document element
Method Detail

callMethod(opts)

a general purpose method for calling API methods via ajax and raising events on success/failure. callbacks can optionally be set for success or failure as well

Parameters:
{Object} opts
options for the method call
{string} opts.method
the method to call
{string} opts.value
value passed to method
{string} opts.successEvent Optional
the type of event to raise on success. default is sc.events.tmdbMethodSuccess
{string} opts.failureEvent Optional
the type of event to raise on failure. default is sc.events.tmdbMethodFailure
{function} opts.onSuccess Optional
a callback function called on success. takes args data, textStatus
{function} opts.onFailure Optional
a callback function called on failure. takes args xhr, msg, exc

{string} getAPIKey()

Gets the API key

Returns:
{string} the api key that was previously set

{string} getURL(method, value)

Method to construct an API URL from the passed method and value strings

Parameters:
{string} method
the string for this parameter. See API docs for list
{string} value
the value we're passing to the API method. This will be encoded using encodeURIComponent()
Returns:
{string} the URL string

movieImages(id, onSuccess, onFailure)

Get images for a movie

Parameters:
{string|number} id
The id of the movie (numeric)
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

movieInfo(id, onSuccess, onFailure)

Get info for a movie

Parameters:
{string|number} id
The id of the movie (numeric)
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

movieInfoHash(hash, onSuccess, onFailure)

Get movie info by file hash

Parameters:
{string} hash
The hash corresponding to the movie
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback
See:
Hash Source Codes

movieInfoIMDB(id, onSuccess, onFailure)

Lookup a movie by IMDB id

Parameters:
{string} id
The IMDB id of the movie. ex "tt0137523"
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

movieSearch(value, onSuccess, onFailure)

Search for movies by title

Parameters:
{string} value
the value passed to the search method
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

personInfo(id, onSuccess, onFailure)

Search for a person

Parameters:
{string|number} id
The id of the person (numeric)
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

personSearch(name, onSuccess, onFailure)

Search for a person

Parameters:
{string} name
The name to search for
{function} onSuccess Optional
a callback
{function} onFailure Optional
a callback

setAPIKey(apikey)

Sets the API key

Parameters:
{string} apikey
the api key used to access the API