Insightly / insightly-ruby

Ruby Library for the Insightly REST API
16 stars 45 forks source link

Will create a new client if it detects a changed api_key. #38

Closed rept closed 7 years ago

rept commented 8 years ago

Currently when you create

Insightly2.api_key = 'cdeda94f-af17-4b8b-9932-xxxxxxxxxxxx'
contacts = Insightly2.client.get_contacts

and some time later you do:

Insightly2.api_key = 'cdeda94f-af17-4b8b-9932-yyyyyyyyyyyy'
contacts = Insightly2.client.get_contacts

it will still use the previous key (...xxxxx) since @client already exists and there is no detection of a changed api_key.

This PR fixes that and will create a new client if it detects a different api_key

rept commented 7 years ago

Any updates on getting this merged?

rept commented 7 years ago

Anybody still maintaining this repo?

kftwotwo commented 7 years ago

Im still getting INSIGHTLY starting [get] request to [Contacts] with no payload and this is what I have Insightly2.api_key = ENV['INSIGHTLY_API_KEY'] Insightly2.client.get_contacts

Am I using this right??

rept commented 7 years ago

@kftwotwo I'm not sure if this is related to my bug fix here. This commit fixed the problem that if you first use a certain api_key and then another one, the client would continue to use the first one.

Beware: unfortunately this fix isn't merged yet.

kftwotwo commented 7 years ago

Opps... I got redirected to here sorry about that @rept