Closed scomma closed 3 years ago
Hi @scomma. I'm currently working on a permanent fix for this but it's taking a bit of time as a lot of internals needs a serious rework to make this fully correct. Will update here once it's ready.
@scomma you can try this branch #32 to see if it fixes your issues.
It removes the key:
option and instead you should change accounts like this:
Omise.secret_api_key = "skey_1"
Omise.use_account(secret_api_key: "skey_2") do
# while in this block all calls will use `skey_2`
charge = Omise::Charge.create(charge)
# etc.
end
# From this point the original key is back.
Omise::Customer.create(customer)
Note that this should also work if you're using multiple threads as Omise.account
uses a thread local variable.
We toggle between multiple keys but it appears the library is working against us in many cases.
Omise.api_key
must be set (I found issue #19 with an identical problem but it was cryptically closed without documenting the solution)Omise::Charge.retrieve('chrg_xxxxxx', key: 'xxxxxxxx')
works, but callingcharge.transaction
on the result results in a transaction not found error, unless I repeat the key withcharge.transaction(key: 'xxxxxxxx')
Omise::List
object doesn't retain the key when I paginate withnext_page
, and this one doesn't even accept the key parameter