Comparing version 0.1.0 to 0.1.1
@@ -25,13 +25,8 @@ module.exports = { | ||
"aggregateStats", | ||
"alertPreferences", | ||
"campaigns", | ||
"concurrents", | ||
"engagement", | ||
"events", | ||
"expandUrl", | ||
"fullDump", | ||
"functions", | ||
"geo", | ||
"ignoredVisitors", | ||
"notifications", | ||
"organics", | ||
@@ -45,3 +40,2 @@ "overview", | ||
"timeSeries", | ||
"trends", | ||
"visitors" | ||
@@ -48,0 +42,0 @@ ] |
@@ -42,7 +42,7 @@ var https = require('https'), | ||
} | ||
this.opts = h.extend(opts, { | ||
this.opts = h.extend({ | ||
requestTimeout: 2000, | ||
version: 'latest', | ||
debugLevel: 'FATAL' | ||
}); | ||
}, opts); | ||
this.config = config; | ||
@@ -105,3 +105,3 @@ }; | ||
var dLevel = this.opts.debugLevel || 'ALL'; | ||
if(!debugLevels[dLevel] & debugLevels[level]) return false; | ||
if(!(debugLevels[dLevel] & debugLevels[level])) return false; | ||
var stream = console.log; | ||
@@ -108,0 +108,0 @@ if(level > debugLevels['NOTICE']) stream = console.error; |
{ | ||
"name": "gosquared", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "GoSquared for your Node.JS application", | ||
@@ -5,0 +5,0 @@ "main": "lib/gosquared.js", |
# node-gosquared | ||
This node module works with the [GoSquared API](https://www.gosquared.com/developer), making it really easy to integrate GoSquared with your node app. | ||
This node module works with the [GoSquared API](api-docs), making it really easy to integrate GoSquared with your node app. | ||
It can be used as an easy proxy so you don't expose your API Key too. | ||
It can be used as an easy proxy for frontend JavaScript so you don't publically expose your API Key. | ||
@@ -11,3 +11,17 @@ ## Installation | ||
``` | ||
## Usage | ||
```javascript | ||
var gosquared = new GoSquared(opts); | ||
``` | ||
##### Options | ||
* api_key: API key from your [account](casa). Required for API functions, not required for tracking functions. | ||
* site_token: Token for the registered site you're working with. Required. | ||
* requestTimeout: Maximum time in ms an API request can be pending. Default 2000ms | ||
* debugLevel: One of 'TRACE', 'NOTICE', 'WARNING', 'ALL'. Default 'ALL' | ||
### API | ||
```javascript | ||
@@ -25,2 +39,31 @@ var GoSquared = require('gosquared'); | ||
}); | ||
``` | ||
``` | ||
All functions listed in the [API documentation](api-docs) are methods you can call on the ```gosquared``` object. | ||
### Tracking | ||
##### Events | ||
Send events to GoSquared: | ||
```javascript | ||
gosquared.storeEvent('Test Event', {its: true, 'you can': 'store', any: 'event', properties: 'You Like' }); | ||
``` | ||
## Run tests | ||
Install all dependencies using ```npm install``` then: | ||
```bash | ||
make test | ||
``` | ||
Optionally, you can run the tests with a site token and API key of your choice: | ||
```bash | ||
SITE_TOKEN=<your token> API_KEY=<your api key> make test | ||
``` | ||
[api-docs]: https://www.gosquared.com/developer/latest/ | ||
[casa]: https://www.gosquared.com/home/developer |
var GoSquared = require('../lib/gosquared'), | ||
should = require('should'), | ||
config = require('../config'); | ||
config = require('../config'), | ||
th = require('../lib/testHelpers'); | ||
var GS, | ||
SITE_TOKEN = process.env.SITE_TOKEN, | ||
API_KEY = process.env.API_KEY; | ||
SITE_TOKEN = process.env.siteToken, | ||
API_KEY = process.env.apiKey; | ||
@@ -15,3 +16,3 @@ before(function(){ | ||
apiKey: API_KEY, | ||
debugLevel: 'ALL' | ||
debugLevel: process.env.verbosity | ||
}); | ||
@@ -23,5 +24,5 @@ }); | ||
it(fName, function(fName, done){ | ||
GS[fName](done); | ||
GS[fName](th.testResponse.bind(this, done)); | ||
}.bind(this, fName)); | ||
}); | ||
}); |
var GoSquared = require('../lib/gosquared'), | ||
should = require('should'); | ||
should = require('should'), | ||
th = require('../lib/testHelpers'); | ||
var GS, | ||
SITE_TOKEN = process.env.SITE_TOKEN, | ||
API_KEY = process.env.API_KEY; | ||
SITE_TOKEN = process.env.siteToken, | ||
API_KEY = process.env.apiKey; | ||
@@ -14,3 +15,3 @@ before(function(){ | ||
apiKey: API_KEY, | ||
debugLevel: 'ALL' | ||
debugLevel: process.env.verbosity | ||
}); | ||
@@ -21,4 +22,4 @@ }); | ||
it('can be stored using storeEvent', function(done){ | ||
GS.storeEvent('Test Event', done); | ||
GS.storeEvent('Test Event', th.testResponse.bind(this, done)); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
10071
11
242
67
1
8