Socket
Socket
Sign inDemoInstall

clang

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clang - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

58

lib/clang.js

@@ -12,26 +12,15 @@ var _ = require('lodash');

me.config = _.clone(config || {});
me.config.version = me.config.version || '1.23'; //api version known to be working
me.wsdl = 'https://secure.myclang.com/app/api/soap/public/index.php?wsdl';
if (!me.config.version) {
//By default this version is locked, because I now it works
me.wsdl += '&version=1.23';
} else if (me.config.version !== '*') {
//Get a specific version by supplying the version number
me.wsdl += '&version=' + me.config.version;
}
me.api = null;
}
Clang.prototype.init = function(callback) {
var me = this;
if (me.config.debug) {
console.log('Creating SOAP client');
}
soap.createClient('https://secure.myclang.com/app/api/soap/public/index.php?wsdl&version=' + me.config.version, function(err, result) {
if (err) {
return callback(err);
}
if (me.config.debug) {
console.log('SOAP client created');
}
me.api = result;
callback(null);
});
};
Clang.prototype.request = function(methodName, args, callback) {

@@ -63,5 +52,21 @@ var me = this;

if (me.api) {
console.log('SOAP client already created');
return setImmediate(callback);
}
me.init(callback);
if (me.config.debug) {
console.log('Creating SOAP client');
}
soap.createClient(me.wsdl, function(err, result) {
if (err) {
return callback(err);
}
if (me.config.debug) {
console.log('SOAP client created');
}
me.api = result;
callback();
});
},

@@ -82,2 +87,3 @@ function async_request(callback){

//Private stuff starts here
var setMethods = {

@@ -91,2 +97,5 @@ CUSTOMER_SET: 'customerSet_getCustomers',

/**
* Normalizes response to an array of objects
*/
var normalizeResponse = function(config, result) {

@@ -122,7 +131,8 @@ if (result.msg === true) {

/**
* Use this callback builder for clang method that use a resource for the dataset. It deals with:
* Factory for clang method callback builder. It deals with:
* - getting a resource id status
* - getting the data set when the resource is READY
* - normalizing the response
* @param api - is reference to a previously created soap client with Clang's wsdl and node-soap
* @param config - a reference to the configuration passed when instantiating Clang
* @param api - a reference to a previously created soap client with Clang's wsdl and node-soap
* @param callback - the method for handling the final data set

@@ -129,0 +139,0 @@ */

{
"name": "clang",
"version": "0.1.6",
"version": "0.1.7",
"description": "Node.js api wrapper for Clang's SOAP api",

@@ -5,0 +5,0 @@ "author": "Christiaan Westerbeek <chris@devotis.nl>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc