ispapi-apiconnector
Advanced tools
Comparing version 2.3.0 to 2.4.0
80
index.js
@@ -12,29 +12,7 @@ /*! | ||
/** | ||
* Util Module | ||
* @private | ||
*/ | ||
var util = require("util"); | ||
/** | ||
* Events Module | ||
* @private | ||
*/ | ||
var events = require("events"); | ||
/** | ||
* @typedef ispapi | ||
* @type {Object} | ||
* @property {Class} Request | ||
* @property {Class} Client | ||
* @property {Class} Response | ||
*/ | ||
var ispapi = {}; | ||
/** | ||
* Module exports. | ||
* @type {ispapi} | ||
*/ | ||
/** | ||
* @alias ispapi.Request | ||
* @alias node.ispapi-apiconnector.Request | ||
* @desc Used to connect to 1API API Backend | ||
@@ -46,3 +24,3 @@ * @augments events.EventEmitter | ||
*/ | ||
ispapi.Request = function(p_socketcfg, p_data) { | ||
var Request = function(p_socketcfg, p_data) { | ||
events.EventEmitter.call(this); | ||
@@ -52,3 +30,3 @@ this.socketcfg = p_socketcfg; | ||
}; | ||
util.inherits(ispapi.Request, events.EventEmitter); | ||
util.inherits(Request, events.EventEmitter); | ||
@@ -58,3 +36,3 @@ /** | ||
*/ | ||
ispapi.Request.prototype.request = function() { | ||
Request.prototype.request = function() { | ||
var oself = this, | ||
@@ -93,12 +71,14 @@ req; | ||
ispapi.Request = Request; | ||
/** | ||
* @alias ispapi.Client | ||
* @alias node.ispapi-apiconnector.Client | ||
* @desc Used to return 1API API Backend connections | ||
* @augments events.EventEmitter | ||
* @constructor | ||
*/ | ||
ispapi.Client = function() { | ||
var Client = function() { | ||
events.EventEmitter.call(this); | ||
}; | ||
util.inherits(ispapi.Client, events.EventEmitter); | ||
util.inherits(Client, events.EventEmitter); | ||
/** | ||
@@ -108,3 +88,3 @@ * convert given command object to string | ||
*/ | ||
ispapi.Client.command_encode = function(p_cmd) { | ||
Client.command_encode = function(p_cmd) { | ||
var key, tmp = ""; | ||
@@ -131,3 +111,3 @@ if (!(typeof p_cmd === 'string' || p_cmd instanceof String)) { | ||
*/ | ||
ispapi.Client.prototype.login = function(p_user, p_pw, p_entity, p_remoteaddr, | ||
Client.prototype.login = function(p_user, p_pw, p_entity, p_remoteaddr, | ||
p_subuser) { | ||
@@ -146,3 +126,3 @@ this.logincfg = { | ||
*/ | ||
ispapi.Client.prototype.setRemoteAddr = function(p_remoteaddr) { | ||
Client.prototype.setRemoteAddr = function(p_remoteaddr) { | ||
this.logincfg.remoteaddr = p_remoteaddr; | ||
@@ -154,3 +134,3 @@ }; | ||
*/ | ||
ispapi.Client.prototype.connect = function(p_url) { | ||
Client.prototype.connect = function(p_url) { | ||
this.socketcfg = require("url").parse(p_url); | ||
@@ -175,3 +155,3 @@ if (!this.socketcfg.protocol.match(/^(http|https):$/)) | ||
*/ | ||
ispapi.Client.prototype.headers = function(p_head) { | ||
Client.prototype.headers = function(p_head) { | ||
if (p_head && !p_head.hasOwnProperty('Expect')) p_head.Expect = ''; | ||
@@ -186,3 +166,3 @@ this.socketcfg.headers = (p_head || { | ||
*/ | ||
ispapi.Client.prototype.createConnection = function(p_cmd) { | ||
Client.prototype.createConnection = function(p_cmd) { | ||
var key, | ||
@@ -203,8 +183,11 @@ data = "", | ||
ispapi.Client = Client; | ||
/** | ||
* @alias ispapi.Response | ||
* @alias node.ispapi-apiconnector.Response | ||
* @desc Used to handle the response of the 1API backend API Constructor | ||
* @param {String} p_r String specifying the unparsed plain API response | ||
* @constructor | ||
*/ | ||
ispapi.Response = function(p_r) { | ||
var Response = function(p_r) { | ||
p_r = ( | ||
@@ -250,3 +233,3 @@ (!p_r || p_r === "") ? | ||
*/ | ||
ispapi.Response.parse = function(r) { | ||
Response.parse = function(r) { | ||
var hash = {}, | ||
@@ -278,3 +261,3 @@ regexp = /^([^\=]*[^\t\= ])[\t ]*=[\t ]*(.*)$/, | ||
*/ | ||
ispapi.Response.serialize = function(r) { | ||
Response.serialize = function(r) { | ||
if (r.DESCRIPTION === "") delete r.DESCRIPTION; | ||
@@ -301,5 +284,5 @@ var plain = "[RESPONSE]", | ||
ispapi.Response.pagerRegexp = /^(TOTAL|FIRST|LAST|LIMIT|COUNT)$/; | ||
Response.pagerRegexp = /^(TOTAL|FIRST|LAST|LIMIT|COUNT)$/; | ||
ispapi.Response.prototype = { | ||
Response.prototype = { | ||
/** | ||
@@ -635,2 +618,15 @@ * sets the columns to be available in the response | ||
/** | ||
* @alias node.ispapi-apiconnector | ||
* @desc Used to interact with the 1API Backend API | ||
* @property {node.ispapi-apiconnector.Request} Request | ||
* @property {node.ispapi-apiconnector.Client} Client | ||
* @property {node.ispapi-apiconnector.Response} Response | ||
*/ | ||
var ispapi = { | ||
Request: Request, | ||
Client: Client, | ||
Response: Response | ||
}; | ||
module.exports = ispapi; |
{ | ||
"name": "ispapi-apiconnector", | ||
"description": "1API API Connector for node.js", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Kai Schwarz", |
20206
600