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

7digital-api

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

7digital-api - npm Package Compare versions

Comparing version 0.5.0-alpha1 to 0.5.0

spec/responses/release-not-found.xml

11

assets/7digital-api-schema.json

@@ -132,4 +132,15 @@ {

]
},
"IpLookup":
{
"resource" : "country",
"actions":
[
{
"apiCall" : "resolve",
"methodName" : "getCountryForIp"
}
]
}
}
}

4

lib/logger.js
var winston = require('winston');
var config = require('../config');

@@ -11,3 +12,4 @@ // Uses winston logger with npm levels and the console transport

colorize: true,
timestamp: true
timestamp: true,
level: config.debug ? 'silly' : 'error'
})

@@ -14,0 +16,0 @@ ]

@@ -80,3 +80,3 @@ var xml2js = require('xml2js'),

parser = new xml2js.Parser({ mergeAttrs: true });
parser = new xml2js.Parser({ mergeAttrs: true, explicitArray: false });

@@ -95,8 +95,8 @@ // Check the request was authorised

delete result['xsi:noNamespaceSchemaLocation'];
if (result.status === 'error') {
callback(result.error);
if (result.response.status === 'error') {
callback(result.response.error);
}
else {
var normalisedResult = self.normaliseResourceArrays(result);
callback(null, result);
var normalisedResult = self.normaliseResourceArrays(result.response);
callback(null, normalisedResult);
}

@@ -103,0 +103,0 @@ });

{
"name": "7digital-api",
"version": "0.5.0-alpha1",
"description": "Simple 7digital API wrapper for nodeJS",
"version": "0.5.0",
"description": "7digital API client for nodeJS",
"homepage": [

@@ -19,6 +19,6 @@ "https://github.com/raoulmillais/node-7digital-api"

"licenses": [
"MIT"
"BSD"
],
"engines": [
"node >= 0.4.1"
"node >= 0.6.0"
],

@@ -30,8 +30,7 @@ "scripts": {

"dependencies": {
"sax": "0.1.2",
"xml2js": ">=0.1.13",
"xml2js": "~0.2.8",
"oauth": "0.9.5",
"step": ">=0.0.3",
"eyes": ">=0.1.6",
"winston": "0.5.7",
"step": "~0.0.5",
"eyes": "~0.1.8",
"winston": "~0.7.0",
"underscore": "1.1.7"

@@ -38,0 +37,0 @@ },

@@ -57,2 +57,19 @@ var ResponseParser = require('../lib/responseparser'),

it('should callback with the error when the status is error', function () {
var callbackSpy = jasmine.createSpy(),
xml = fs.readFileSync(
path.join(__dirname, 'responses', 'release-not-found.xml'),
'utf-8');
parser.format = 'js';
parser.parse(callbackSpy, null, xml)
expect(callbackSpy).toHaveBeenCalled();
var error = callbackSpy.mostRecentCall.args[0];
var response = callbackSpy.mostRecentCall.args[1];
expect(error).toBeDefined();
expect(response).not.toBeDefined();
expect(error.code).toEqual('2001');
expect(error.errorMessage).toEqual("Release not found");
});
it('should normalise single resource responses into an array', function() {

@@ -68,8 +85,8 @@ var callbackSpy = jasmine.createSpy(),

expect(callbackSpy).toHaveBeenCalled();
var response = callbackSpy.mostRecentCall.args[1].response;
console.log(response);
expect(response.tracks[0].track).toBeAnArray();
var response = callbackSpy.mostRecentCall.args[1];
expect(response.tracks.track).toBeAnArray();
});
// Note that basket items are one level deeper than other arrays, hence
// the separate test.
// Note that basket items are one level deeper than other arrays, hence
// the separate test.
it("should normalise basket items into an array", function () {

@@ -82,6 +99,5 @@ var callbackSpy = jasmine.createSpy()

expect(callbackSpy).toHaveBeenCalled();
response = callbackSpy.mostRecentCall.args[1].response;
console.log(response);
expect(response.basket[0].basketItems).toBeAnArray();
response = callbackSpy.mostRecentCall.args[1];
expect(response.basket.basketItems).toBeAnArray();
});
});
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