Socket
Socket
Sign inDemoInstall

fastbill-automatic

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.4

51

lib/fastbill.js

@@ -68,18 +68,41 @@ /*!

for (var props in res.RESPONSE) {
//if there is only one, no Array
if (res.RESPONSE[props].length == 1) {
var resAry = [];
callback(res.RESPONSE[props][0]);
res.RESPONSE[props].forEach(function (e) {
resAry.push(e);
});
} else {
callback(resAry);
var resAry = [];
//break after first element
break;
}
res.RESPONSE[props].forEach(function (e) {
resAry.push(e);
});
});
},
getOne: function (type, params, callback) {
callback(resAry);
}
//break after first element
// build the fastbill styled Query
params = {
data: _.extend(params, {"SERVICE": type + '.get', "LIMIT": 1}),
headers: this.config.headers
};
// use node-rest-client for communication
this.client.post(this.config.serviceUrl, params, function (data, response) {
// parsed response body as js object
var res = null;
try {
res = JSON.parse(data);
} catch (e) {
console.error('fastbill error: could not parse create response');
}
if (!res) {
callback(null);
return;
}
// get first property of Response-OBJ and fire the callback!
for (var props in res.RESPONSE) {
callback(res.RESPONSE[props][0]);
break;

@@ -109,3 +132,3 @@ }

}
if(res && typeof res === 'object' && res.RESPONSE){
if (res && typeof res === 'object' && res.RESPONSE) {
callback(res.RESPONSE);

@@ -137,3 +160,3 @@ } else {

}
if(res && typeof res === 'object' && res.RESPONSE){
if (res && typeof res === 'object' && res.RESPONSE) {
callback(res.RESPONSE);

@@ -166,3 +189,3 @@ } else {

}
if(res && typeof res === 'object' && res.RESPONSE){
if (res && typeof res === 'object' && res.RESPONSE) {
callback(res.RESPONSE);

@@ -169,0 +192,0 @@ } else {

{
"name": "fastbill-automatic",
"version": "0.0.2",
"version": "0.0.4",
"description": "This module is an early implementation of some features of the fastbill-api.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -18,6 +18,6 @@ # fastbill-automatic

This Module exposes the following methods:
On top of your file require the module and initialize it.
```js
var Fastbill = require('fastbill-automatic');
###### `get()`
```js
var fastbill = new Fastbill({

@@ -27,3 +27,9 @@ user : '####',

});
});
```
This Module exposes the following methods:
###### `get()`
```js
fastbill.get("customer",{"FILTER": {}, LIMIT: 2},function(res){

@@ -33,2 +39,8 @@ console.log(res);

```
###### `getOne()`
```js
fastbill.getOne("customer",{"FILTER": {}},function(res){
console.log(res);
});
```
###### `create()`

@@ -35,0 +47,0 @@ ```js

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc