Closed wvteijlingen closed 6 years ago
Ah I just found that it doesn't work because signature
is called here.
Would it be possible to update this to use @client.signature.create
? That way we can use use multiple Bunq clients at the same time, instead of being restricted to one 'singleton' instance.
Bunq.client
already returns a new instance every time you call it. So in that sense it is not a singleton, however the config is indeed the same for all instances. Do you need separate configs for each client? Could you elaborate a bit more on the use case?
I'm using an abstraction over this library, which provides a generic api to connect to multiple banks. This wrapper does not impose any restrictions on configuration or singleton. It basically looks like this:
client = BunqClient.new(sandbox: true, private_key: "", server_public_key: "", installation_token: "")
user = client.fetch_customer(api_key: "some_key")
Because of this it is technically possible to create a single BunqClient
and fetch different users, or instantiate multiple BunqClient
s. Unfortunately that doesn't work very well now because the configuration is shared between every instance of BunqClient
.
I could work around this, but I think generally it would be nicer if there was at least the ability not to share configuration between instances. By updating this to @client.signature.create
both cases are supported (as far as I can see).
Created https://github.com/jorttbv/bunq-client/pull/12. I think this will suite your needs. Can you please check? There was another reference to Bunq.signature
here.
Can I use this library without configuring the global Bunq module? So, will initializing a client as follows work?
I looked through the code and it seems supported. However, I'm a bit worried about this method, because it uses the global configuration instance. However, I cannot find this method being called anywhere.