xtian / node-armory

A simple node.js wrapper around Blizzard's REST API for World of Warcraft.
MIT License
24 stars 8 forks source link

How to set publicKey/privateKey #5

Closed kimptoc closed 11 years ago

kimptoc commented 11 years ago

Hi,

I am trying to set the public/private keys like so:

a=require('armory')

a.publicKey=process.env.WOW_API_PUBLIC_KEY

a.privateKey=process.env.WOW_API_PRIVATE_KEY

a.classes({region:"eu"},function(){})

a has the properties set, but its not seeing them internally to use in the actual api call. I guess I am doing it wrong.

It looks to me as if the wrap/initParam's functions are ensuring the calls use the original armory object and not the one I have set the properties on, and I cant see a way to set the properties on the underlying original armory object.

So, I thought this might work:

a = require('armory')

a.publicKey=process.env.WOW_API_PUBLIC_KEY

a.privateKey=process.env.WOW_API_PRIVATE_KEY

b = a.defaults({})

b.classes({region:"eu"},function(){})

But still no joy - how do I do it?

Thanks, Chris

xtian commented 11 years ago

Whoops, that was a dumb mistake. :)

Sorry about that!

kimptoc commented 11 years ago

No problem - keeps me on my JS toes :)