lib/resource.js
function Resource(options, schema) {
	this.logger = options.logger;
	this.resourceName = options.resourceDefinition.resource;
	this.host = options.resourceDefinition.host || schema.host;
	this.sslHost = options.resourceDefinition.sslHost || schema.sslHost;
	this.port = options.resourceDefinition.port || schema.port;
	this.prefix = options.resourceDefinition.prefix || schema.prefix;
	this.consumerkey = options.consumerkey;
	this.consumersecret = options.consumersecret;

	if(this.logger.silly) {
		this.logger.silly('Creating constructor for resource: ' + this.resourceName);
	}

	_.each(options.resourceDefinition.actions,
		function processAction(action) {
			this.createAction(action, options.userManagement);
		}, this);
}
function Resource(options, schema) {
	this.logger = options.logger;
	this.resourceName = options.resourceDefinition.resource;
	this.host = options.resourceDefinition.host || schema.host;
	this.sslHost = options.resourceDefinition.sslHost || schema.sslHost;
	this.port = options.resourceDefinition.port || schema.port;
	this.prefix = options.resourceDefinition.prefix || schema.prefix;
	this.consumerkey = options.consumerkey;
	this.consumersecret = options.consumersecret;

	if(this.logger.silly) {
		this.logger.silly('Creating constructor for resource: ' + this.resourceName);
	}

	_.each(options.resourceDefinition.actions,
		function processAction(action) {
			this.createAction(action, options.userManagement);
		}, this);
}
function Resource ( options , schema ) { this . logger = options . logger ; this . resourceName = options . resourceDefinition . resource ; this . host = options . resourceDefinition . host || schema . host ; this . sslHost = options . resourceDefinition . sslHost || schema . sslHost ; this . port = options . resourceDefinition . port || schema . port ; this . prefix = options . resourceDefinition . prefix || schema . prefix ; this . consumerkey = options . consumerkey ; this . consumersecret = options . consumersecret ; if ( this . logger . silly ) { this . logger . silly ( 'Creating constructor for resource: ' + this . resourceName ) ; } _ . each ( options . resourceDefinition . actions , function processAction ( action ) { this . createAction ( action , options . userManagement ) ; } , this ) ; }
A resource on the API, instances of this are used as the prototype of instances of each API resource.  This constructor will build up a method for each action that can be performed on the resource.  - @param {Object} options - @param {Object} schema  The `options` argument should have the following properties:  - `resourceDefinition` - the definition of the resource and its actions from the schema definition. - `consumerkey` - the oauth consumerkey - `consumersecret` the oauth consumersecret - `schema` - the schema defintion - `format` - the desired response format - `logger` - for logging output
A resource on the API instances of this are used as the prototype of instances of each API resource . This constructor will build up a method for each action that can be performed on the resource . -