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

gravity-forms-api

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gravity-forms-api - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

62

lib/index.js

@@ -26,5 +26,5 @@ 'use strict';

if (isValid(apiCreds)) {
this.setup(apiCreds);
this._setup(apiCreds);
} else {
this.throwError('Invalid api credentials');
this._throwError('Invalid api credentials');
}

@@ -34,2 +34,27 @@ }

_createClass(GravityFormsApi, [{
key: '_setup',
value: function _setup(options) {
var apiKey = options.apiKey;
var domain = options.domain;
var privateKey = options.privateKey;
this.apiKey = apiKey;
this.privateKey = privateKey;
this.baseEndPoint = domain + '/gravityformsapi';
}
}, {
key: '_convertToFutureUnixTime',
value: function _convertToFutureUnixTime(expirationInSeconds) {
var currentDate = new Date();
var unixTimeInSeconds = parseInt(currentDate.getTime() / 1000, 10);
return unixTimeInSeconds + expirationInSeconds;
}
}, {
key: '_throwError',
value: function _throwError(desc) {
throw new Error(desc);
}
}, {
key: 'createSignature',

@@ -40,6 +65,6 @@ value: function createSignature(method, route) {

if (!method || !route) {
this.throwError('GravityFormsApi.createSignature is Missing required arguments');
this._throwError('GravityFormsApi.createSignature is Missing required arguments');
}
var futureUnixTime = this.convertToFutureUnixTime(expirationInSeconds);
var futureUnixTime = this._convertToFutureUnixTime(expirationInSeconds);

@@ -61,6 +86,6 @@ var stringToSign = this.apiKey + ':' + method + ':' + route + ':' + futureUnixTime;

if (!domain || !route || !signature) {
this.throwError('GravityFormsApi.request is Missing required arguments');
this._throwError('GravityFormsApi.request is Missing required arguments');
}
var futureUnixTime = this.convertToFutureUnixTime(expirationInSeconds);
var futureUnixTime = this._convertToFutureUnixTime(expirationInSeconds);
var url = this.baseEndPoint + '/' + route + '?api_key=' + this.apiKey + '&signature=' + signature + ('&expires=' + futureUnixTime + '&paging[page_size]=' + maxResults);

@@ -70,27 +95,2 @@

}
}], [{
key: 'setup',
value: function setup(options) {
var apiKey = options.apiKey;
var domain = options.domain;
var privateKey = options.privateKey;
this.apiKey = apiKey;
this.privateKey = privateKey;
this.baseEndPoint = domain + '/gravityformsapi';
}
}, {
key: 'convertToFutureUnixTime',
value: function convertToFutureUnixTime(expirationInSeconds) {
var currentDate = new Date();
var unixTimeInSeconds = parseInt(currentDate.getTime() / 1000, 10);
return unixTimeInSeconds + expirationInSeconds;
}
}, {
key: 'throwError',
value: function throwError(desc) {
throw new Error(desc);
}
}]);

@@ -97,0 +97,0 @@

{
"name": "gravity-forms-api",
"version": "0.0.4",
"version": "0.0.5",
"description": "Basic module that creates signatures and requests data from gravity forms endpoints",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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