//
// class: VimeoCaller
//
// used for making calls to Vimeo API
//
// Author: Alexander Dahlberg
/////////////////////////////////////////

function VimeoCaller(format) {
	
	this.format = format; // can be 'JSON' or 'XML'
	this.jsonp = '?callback=?'; // makes cross-domain calls possible

	
	// getAlbum() 
	// Returns all clips from album_id in specified format.
	// Format is optional. 
	this.getAlbum = function(album_id, callback, format) {
		
		var url = 'http://vimeo.com/api/album/'+album_id+'/clips';
		
		// if format is not specified, use value specified in constructor
		if(format === undefined) format = this.format;
		
		switch(format) {

		case 'JSON': // JSON
		
			$.getJSON(url+'.json'+this.jsonp, callback); // make request
			break;
			
		case 'XML': // XML
			// code here
			break;
		}
	
	}	

	
	// getClips() 
	// Returns all clips from user_id in specified format
	// Format is optional
	this.getClips = function(user_id, callback) {

		var url = 'http://vimeo.com/api/'+user_id+'/clips';
		
		// if format is not specified, use value specified in constructor
		if(format === undefined) format = this.format;
		
		switch(format) {

		case 'JSON': // JSON
		
			$.getJSON(url+'.json'+this.jsonp, callback); // make request
			break;
			
		case 'XML': // XML
			// code here
			break;
		}

	}
	
}
