{"size": 3557, "ext": "js", "max_stars_repo_path": "library/FreshBooks/Estimate.js", "max_stars_repo_name": "nguyentuandat/freshbooks-javascript-library", "max_stars_repo_stars_event_min_datetime": "2015-03-19T07:03:08.000Z", "max_stars_repo_stars_event_max_datetime": "2018-07-27T16:06:30.000Z", "max_issues_repo_path": "library/FreshBooks/Estimate.js", "max_issues_repo_name": "nguyentuandat/freshbooks-javascript-library", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "library/FreshBooks/Estimate.js", "max_forks_repo_name": "nguyentuandat/freshbooks-javascript-library", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.0078740157, "max_line_length": 106, "alphanum_fraction": 0.7388248524}
FreshBooks_Estimate.prototype = new FreshBooks_BaseInvoice();
FreshBooks_Estimate.prototype.constructor = FreshBooks_Estimate;
FreshBooks_Estimate.superclass = FreshBooks_BaseInvoice.prototype;
/**
 * FreshBooks Estimate Class
 * @copyright  Milan Rukavina, rukavinamilan@gmail.com
 * @version    1.0
 * @extends FreshBooks_BaseInvoice
 * @constructor
 */
function FreshBooks_Estimate() 
{
	this.elementName = "estimate";
	this.estimateId = "";
}

/**
* return XML content
*/	
FreshBooks_Estimate.prototype.internalXMLContent = function()
{
	var content =
						this.getTagXML("estimate_id",this.estimateId) +							
						FreshBooks_BaseInvoice.prototype.internalXMLContent.call(this);
						
	return content;
}

/**
* load obect properties from SimpleXML object
*/	
FreshBooks_Estimate.prototype.internalLoadXML = function(XMLObject)
{
	this.estimateId = this.getXMLElementValue(XMLObject,"estimate_id");		
	
	FreshBooks_BaseInvoice.prototype.internalLoadXML.call(this,XMLObject);
}
	
/**
* prepare XML string request for CREATE server method
*/		
FreshBooks_Estimate.prototype.internalCreate = function(responseStatus,XMLObject)
{
	if(responseStatus){
		this.estimateId = this.getXMLElementValue(XMLObject.getElementsByTagName('response')[0],"estimate_id");
	}
}	

/**
* prepare XML string request for GET server method
*/ 	
FreshBooks_Estimate.prototype.internalPrepareGet = function(id,content)
{
	return this.getTagXML("estimate_id",id);
}

/**
* process XML string response from GET server method
*/		
FreshBooks_Estimate.prototype.internalGet = function(responseStatus,XMLObject)
{
	if(responseStatus)
		this.internalLoadXML(XMLObject.getElementsByTagName('estimate')[0]);
}

/**
* prepare XML string request for DELETE server method
*/			
FreshBooks_Estimate.prototype.internalPrepareDelete = function(content)
{
	return this.getTagXML("estimate_id",this.estimateId);
}

/**
* process XML string response from DELETE server method
*/	
FreshBooks_Estimate.prototype.internalDelete = function(responseStatus,XMLObject)
{
	FreshBooks_BaseInvoice.prototype.internalDelete.call(this,responseStatus,XMLObject);
	if(responseStatus){
		this.estimateId = null;
	}
}

/**
* process XML string response from LIST server method
*/	 	
FreshBooks_Estimate.prototype.internalListing = function(responseStatus,XMLObject)
{
	var result = Object();
	var resultEstimates = Array();
	if(responseStatus){
		var estimates = XMLObject.getElementsByTagName('estimate');
		if(estimates.length > 0){
			resultEstimates.length = estimates.length;		
			for(var i = 0; i < estimates.length; i++){
				var thisEstimate = new FreshBooks_Estimate();
				thisEstimate.internalLoadXML(estimates[i]);
				resultEstimates[i] = thisEstimate;
			}
		}
	}
	var estimatesInfo = XMLObject.getElementsByTagName('estimates')[0];
	result.page = estimatesInfo.getAttribute('page');
	result.perPage = estimatesInfo.getAttribute('per_page');
	result.pages = estimatesInfo.getAttribute('pages');
	result.total = estimatesInfo.getAttribute('total');
	result.rows = resultEstimates;
	return result;
}

/**
* prepare XML string request for SENDBYEMAIL server method
*/		
FreshBooks_Estimate.prototype.internalPrepareSendByEmail = function(content)
{
	return this.getTagXML("estimate_id",this.estimateId);
}

/**
* process XML string response from SENDBYEMAIL server method
*/		
FreshBooks_Estimate.prototype.internalSendByEmail = function(responseStatus,XMLObject)
{
	//
}
