dmcquay / node-apac

node-apac - Node.js client for the Amazon Product Advertising API, including support of Request Signatures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot set locale

Hucho opened this issue · comments

Hi Dustin,

that's how I create my credetials...

//config/credentials.js
var Credentials = function(ctryCode){
    this.awsId = 'myID';
    this.awsSecret = 'mySecretKey';
    this.version = '2013-08-01';
//check countryCode and return corresponding tracking id
    checkCode = function(ctryCode){
        if(ctryCode == 'US'){
            return 'US tracking id';
        }
        else if(ctryCode == 'DE'){
            return 'DE tracking id';
        }
        else {return '';}
    }
    this.assocId = checkCode(ctryCode);
    this.locale = ctryCode;
}
//export credentials
module.exports = Credentials;

Then I create a new OperationsHelper:


function Request(){
    var OperationHelper = require('apac').OperationHelper;
    var Credentials = require('./config/credentials');
    var cred = new Credentials('DE');
    var opHelper = new OperationHelper(cred);
    app.get('/Request', function(req, res){...}

Request();

In the browser, the answer still results from: http://webservices.amazon.com/AWSECommerceService/2013-08-01

What am I doing wrong? I thought I can just pass the locale parameter to the OperationsHelper? Even if I set the default locale in your locale.js file to "DE",
it does not work?

Best

Hucho

You closed this. Does that mean you figured it out? If not, you can reference this test to see how to set locale:

https://github.com/dmcquay/node-apac/blob/master/lib/operation-helper.specs.js#L33