7digital-api
Advanced tools
Comparing version 0.5.0-alpha1 to 0.5.0
@@ -132,4 +132,15 @@ { | ||
] | ||
}, | ||
"IpLookup": | ||
{ | ||
"resource" : "country", | ||
"actions": | ||
[ | ||
{ | ||
"apiCall" : "resolve", | ||
"methodName" : "getCountryForIp" | ||
} | ||
] | ||
} | ||
} | ||
} |
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(); | ||
}); | ||
}); |
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
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
74927
6
46
1540
+ Addedasync@0.2.10(transitive)
+ Addedaws-sign@0.2.1(transitive)
+ Addedboom@0.3.8(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedcookie-jar@0.2.0(transitive)
+ Addedcryptiles@0.1.3(transitive)
+ Addedcycle@1.0.3(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addedforever-agent@0.2.0(transitive)
+ Addedform-data@0.0.10(transitive)
+ Addedhawk@0.10.2(transitive)
+ Addedhoek@0.7.6(transitive)
+ Addedjson-stringify-safe@3.0.0(transitive)
+ Addedmime@1.2.11(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.2.0(transitive)
+ Addedpkginfo@0.3.1(transitive)
+ Addedqs@0.5.6(transitive)
+ Addedrequest@2.16.6(transitive)
+ Addedsax@0.5.8(transitive)
+ Addedsntp@0.1.4(transitive)
+ Addedstep@0.0.6(transitive)
+ Addedtunnel-agent@0.2.0(transitive)
+ Addedwinston@0.7.3(transitive)
+ Addedxml2js@0.2.8(transitive)
- Removedsax@0.1.2
- Removedasync@0.1.22(transitive)
- Removedloggly@0.3.11(transitive)
- Removedpkginfo@0.2.3(transitive)
- Removedrequest@2.9.203(transitive)
- Removedsax@0.1.21.4.1(transitive)
- Removedstep@1.0.0(transitive)
- Removedtimespan@2.3.0(transitive)
- Removedwinston@0.5.7(transitive)
- Removedxml2js@0.6.2(transitive)
- Removedxmlbuilder@11.0.1(transitive)
Updatedeyes@~0.1.8
Updatedstep@~0.0.5
Updatedwinston@~0.7.0
Updatedxml2js@~0.2.8