amazon-book-search-se
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -5,3 +5,3 @@ // requires | ||
function amazonBookSearch(settings){ | ||
if(!settings || !settings.awsKey || !settings.awsSecret){ | ||
if(!settings || !settings.awsKey || !settings.awsSecret || !settings.assocId){ | ||
this.configured = false; | ||
@@ -22,3 +22,3 @@ } else { | ||
if(!this.configured){ | ||
callback({ message: 'amazonBookSearch must be configured correctly before use.' }, null); | ||
callback({ message: 'Service must be configured correctly before use.' }, null); | ||
return; | ||
@@ -35,3 +35,8 @@ } | ||
return callback(error, null); | ||
}; | ||
}; | ||
for(var i=0; i < result.results.length; i++){ | ||
console.log("result.results[" + i + "]", result.results[i].ItemAttributes); | ||
} | ||
callback(null, result); | ||
@@ -38,0 +43,0 @@ }; |
@@ -5,5 +5,7 @@ var apacOperationHelper = require('apac').OperationHelper; | ||
this.apiClient = new apacOperationHelper({ | ||
awsId: settings.awsKey, | ||
awsId: settings.awsKey, | ||
awsSecret: settings.awsSecret, | ||
assocId: settings.associate || 'wobonic' | ||
assocId: settings.assocId, | ||
maxRequestsPerSecond: 1, | ||
xml2jsOptions: { explicitArray: true } | ||
}); | ||
@@ -29,3 +31,4 @@ }; | ||
this.apiClient.execute('ItemSearch', query, function(response) { | ||
this.apiClient.execute('ItemSearch', query).then((response) => { | ||
var responseResult = response.result; | ||
var output = {}; | ||
@@ -36,12 +39,12 @@ if(page !== undefined && page !== null){ | ||
if(!response.ItemSearchResponse && response.ItemSearchErrorResponse){ | ||
return callback({ message: response.ItemSearchErrorResponse.Error[0] }, null); | ||
if(!responseResult.ItemSearchResponse && responseResult.ItemSearchErrorResponse){ | ||
return callback(new Error(responseResult.ItemSearchErrorResponse.Error[0]), null); | ||
} | ||
if(!response.ItemSearchResponse.Items[0].Request[0].IsValid[0]){ | ||
return callback({ message: response.ItemSearchResponse.Items[0].Request[0].Errors[0].Error[0].Message[0] }, null); | ||
if(!responseResult.ItemSearchResponse.Items[0].Request[0].IsValid[0]){ | ||
return callback(new Error(responseResult.ItemSearchResponse.Items[0].Request[0].Errors[0].Error[0].Message[0]), null); | ||
} | ||
var results = response.ItemSearchResponse.Items[0].Item; | ||
var totalResults = response.ItemSearchResponse.Items[0].TotalResults[0]; | ||
var totalPages = response.ItemSearchResponse.Items[0].TotalPages[0]; | ||
var results = responseResult.ItemSearchResponse.Items[0].Item; | ||
var totalResults = responseResult.ItemSearchResponse.Items[0].TotalResults[0]; | ||
var totalPages = responseResult.ItemSearchResponse.Items[0].TotalPages[0]; | ||
@@ -54,2 +57,4 @@ if(!results){ | ||
callback(null, output); | ||
}).catch((err) => { | ||
callback(err, null); | ||
}); | ||
@@ -56,0 +61,0 @@ } |
{ | ||
"name": "amazon-book-search-se", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Simple wrapper around apac to return book results from Amazon's Product Advertising API. Based on amazon-book-search by kuryaki.", | ||
@@ -15,2 +15,6 @@ "main": "amazon-book-search-se.js", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/retroburst/amazon-book-search-se.git" | ||
}, | ||
"author": "Andrew D (retroburst) based on code by David Roncancio (kuryaki).", | ||
@@ -21,4 +25,4 @@ "license": "BSD-2-Clause", | ||
"dependencies": { | ||
"apac": "0.0.13" | ||
"apac": "~2.0.0" | ||
} | ||
} |
@@ -10,3 +10,3 @@ ## Amazon Book Search SE | ||
$ npm install amazon-book-search | ||
$ npm install amazon-book-search-se | ||
@@ -20,3 +20,3 @@ ### Requirements | ||
var amazonBookSearchSE = require('amazon-book-search-se'); | ||
var absse = new amazonBookSearchSE('awsKey', 'awsSecret', 'awsAssociateId'); | ||
var absse = new amazonBookSearchSE({ awsKey: "YOUR KEY", awsSecret: "YOUR SECRET", assocId: "YOUR ASSOCIATE TAG" }); | ||
@@ -23,0 +23,0 @@ // search by ISBN |
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
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
23293
88
0
+ Addedapac@2.0.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedxml2js@0.4.16(transitive)
+ Addedxmlbuilder@4.2.1(transitive)
- Removedajv@6.12.6(transitive)
- Removedapac@0.0.13(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.13.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedxml2js@0.6.2(transitive)
- Removedxmlbuilder@11.0.1(transitive)
Updatedapac@~2.0.0