Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gn-api-sdk-node

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gn-api-sdk-node - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

48

lib/gn-endpoints.js

@@ -16,3 +16,3 @@ 'use strict';

GnEndpoints.prototype.run = function(name, params, body) {
GnEndpoints.prototype.run = function (name, params, body) {
var self = this;

@@ -34,9 +34,9 @@ self.defer = q.defer();

GnEndpoints.prototype.getAccessToken = function() {
GnEndpoints.prototype.getAccessToken = function () {
var self = this;
return this.gnAuth.getAccessToken()
.then(function(response) {
.then(function (response) {
self.accessToken = response.access_token;
return self.accessToken;
}).catch(function(err) {
}).catch(function (err) {
return err;

@@ -46,3 +46,3 @@ });

GnEndpoints.prototype.getResponse = function(response, body) {
GnEndpoints.prototype.getResponse = function (response, body) {
return this.options

@@ -52,16 +52,16 @@ .raw_response ? response : body;

GnEndpoints.prototype.req = function(callback) {
GnEndpoints.prototype.req = function (callback) {
request[this.endpoint.method](this.getParams.call(this,
this.endpoint.route), callback);
}
};
GnEndpoints.prototype.directReq = function() {
GnEndpoints.prototype.directReq = function () {
this.req(this.directReqCallback.bind(this));
};
GnEndpoints.prototype.withTokenReq = function() {
GnEndpoints.prototype.withTokenReq = function () {
this.req(this.withTokenReqCallback.bind(this));
};
GnEndpoints.prototype.getParams = function(route) {
GnEndpoints.prototype.getParams = function (route) {
var self = this;

@@ -77,4 +77,4 @@ var regex = /\:(\w+)/g;

var getVariables = function() {
return placeholders.map(function(item) {
var getVariables = function () {
return placeholders.map(function (item) {
return item.replace(':', '');

@@ -84,5 +84,5 @@ });

var updateRoute = function() {
var updateRoute = function () {
var variables = getVariables();
variables.forEach(function(value, index) {
variables.forEach(function (value, index) {
if (params[value]) {

@@ -95,6 +95,6 @@ route = route.replace(placeholders[index], params[value]);

var getQueryString = function() {
var getQueryString = function () {
var keys = Object.keys(params);
var initial = keys.length >= 1 ? '?' : '';
return keys.reduce(function(previous, current, index, array) {
return keys.reduce(function (previous, current, index, array) {
var next = (index === array.length - 1) ? '' : '&';

@@ -110,8 +110,14 @@ return [previous, current, '=',

var headers = {
'api-sdk': 'node-' + sdkPackage.version
};
if (this.options.partner_token) {
headers['partner-token'] = this.options.partner_token;
}
var req = {
url: [this.options.baseUrl, route, query].join(''),
json: true,
headers: {
'api-sdk': 'node-' + sdkPackage.version
},
headers: headers,
body: this.body

@@ -129,3 +135,3 @@ };

GnEndpoints.prototype.withTokenReqCallback = function(err, httpResponse, httpResponseBody) {
GnEndpoints.prototype.withTokenReqCallback = function (err, httpResponse, httpResponseBody) {
var self = this;

@@ -145,3 +151,3 @@ var response = self.getResponse(httpResponse, httpResponseBody);

GnEndpoints.prototype.directReqCallback = function(err, httpResponse, bodyResponse) {
GnEndpoints.prototype.directReqCallback = function (err, httpResponse, bodyResponse) {
var response = this.getResponse(httpResponse, bodyResponse);

@@ -148,0 +154,0 @@

{
"name": "gn-api-sdk-node",
"description": "Module for integration with Gerencianet API",
"version": "0.0.17",
"version": "0.0.18",
"author": "Francisco Carvalho <f.thiene@gmail.com>",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -20,3 +20,9 @@ # gn-api-sdk-node

```
## Tested with
```
node 0.12.7, 4.4.0 and 4.4.4
```
## Basic usage

@@ -23,0 +29,0 @@

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