amz-products
Advanced tools
Comparing version 0.0.2 to 0.0.3
56
index.js
@@ -10,2 +10,3 @@ var amazonWrapper = require("apac").OperationHelper; | ||
assocId: credentials.associateId, | ||
endPoint: determineLocale(credentials.locale), | ||
xml2jsOptions: { | ||
@@ -119,1 +120,56 @@ explicitArray: false, | ||
} | ||
function determineLocale(locale) { | ||
if (locale) { | ||
locale = locale.toUpperCase(); | ||
} | ||
switch (locale) { | ||
case 'BR': | ||
return 'webservices.amazon.com.br'; | ||
break; | ||
case 'CA': | ||
return 'webservices.amazon.ca'; | ||
break; | ||
case 'CN': | ||
return 'webservices.amazon.cn'; | ||
break; | ||
case 'FR': | ||
return 'webservices.amazon.fr'; | ||
break; | ||
case 'DE': | ||
return 'webservices.amazon.de'; | ||
break; | ||
case 'IN': | ||
return 'webservices.amazon.in'; | ||
break; | ||
case 'IT': | ||
return 'webservices.amazon.it'; | ||
break; | ||
case 'JP': | ||
return 'webservices.amazon.co.jp'; | ||
break; | ||
case 'MX': | ||
return 'webservices.amazon.com.mx'; | ||
break; | ||
case 'ES': | ||
return 'webservices.amazon.es'; | ||
break; | ||
case 'UK': | ||
return 'webservices.amazon.co.uk'; | ||
break; | ||
default: | ||
return 'webservices.amazon.com'; | ||
} | ||
} |
{ | ||
"name": "amz-products", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A thin wrapper for the Amazon Products API, supporting all methods on the API.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# AMZ Products | ||
This module is a thin wrapper around the Amazon Products API. Unlike other modules, which only support one or two methods, this wrapper supports all the methods of the API. | ||
This module is a thin wrapper around the Amazon Products API. Unlike other modules, which only support one or two methods, this wrapper supports all the methods of the API. | ||
The module is intentionally naive. It acts as a simple wrapper, allowing you to pass any valid options to the methods and returns the root response object from Amazon. I kept it this way, so you'll have the maximum flexibility in how you deal with responses. | ||
The module is intentionally naive. It acts as a simple wrapper, allowing you to pass any valid options to the methods and returns the root response object from Amazon. I kept it this way, so you'll have the maximum flexibility in how you deal with responses. | ||
@@ -52,5 +52,40 @@ Oh, and it returns JSON, not XML. | ||
### Locale Settings | ||
The Product Advertising API support different locales, and so does this module. To use a different locale, simply pass the locale ID in when initializing the module. Example: | ||
~~~javascript | ||
var AmazonAPI = require('amz-products'); | ||
var amazon = new AmazonAPI({ | ||
accessKeyId: //your access key | ||
secretAccessKey: //your secret access key | ||
associateId: //your associate ID | ||
locale: 'UK' | ||
}); | ||
~~~ | ||
The module defaults to "US", and passing a locale isn't required. Locale codes are as follows: | ||
Locale | Code | ||
--------------|---------- | ||
Brazil | BR | ||
Canada | CA | ||
China | CN | ||
France | FR | ||
Germany | DE | ||
India | IN | ||
Italy | IT | ||
Japan | JP | ||
Mexico | MX | ||
Spain | ES | ||
United Kingdom| UK | ||
United States | US | ||
### Why Another Amazon Products API Module? | ||
Frankly, all the ones I've come across on npm suck. Either they don't support all the methods, or they provide an arcane interface to the API. I'm passionate about developer experience, and want an API wrapper that makes sense, is fully featured, and is dead simple to use. | ||
Frankly, all the ones I've come across on npm suck. Either they don't support all the methods, or they provide an arcane interface to the API. I'm passionate about developer experience, and want an API wrapper that makes sense, is fully featured, and is dead simple to use. | ||
@@ -60,2 +95,1 @@ ### What Else? | ||
Not much, really. If you've got ideas or suggestions for improving, create an issue or simply issue a pull request. | ||
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
19225
4
141
94
1