Sha256: f7ff2171e0672d00cc487e77223ebcddd841c2df822f47f8b774bbfbfb427958

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

Object.extend = function(destination, source) {
    for (var property in source) {
        if (source.hasOwnProperty(property)) {
            destination[property] = source[property];
        }
    }
    return destination;
};

var Response = function(){
	var exception = "";

	this.__defineGetter__("params",function(){
		return params;
	});

	this.__defineSetter__("params",function(arg){
		params = arg;
	});

	this.__defineGetter__("header",function(){
		return header;
	});

	this.__defineSetter__("header",function(arg){
		header = arg;
	});

	this.__defineGetter__("exception",function(){
		return exception;
	});

	this.__defineSetter__("exception",function(arg){
		exception = arg;
	});

	this.send = function(data){
		var ballroom = require("./ballroom");
		var user_json = {};

		//if callback we are sending request to ruby
		if(data['callback']){
			this.params = null;
			this.header['route'] = 'request';
			user_json = data;
		}
		else{
			user_json["result"] = data;
		}

		Object.extend(user_json,this.params);
		Object.extend(user_json,this.header);
		Object.extend(user_json,this.exception);
		ballroom.send(user_json);
	};
};
module.exports = Response;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rhoconnect-4.0.0.beta.10 js-adapters/response.js