Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing API key in individual calls #51

Closed

Conversation

veechau
Copy link
Contributor

@veechau veechau commented Nov 30, 2018

Allow passing of API for individual calls in order to allow for thread safe usage of multiple API keys.

@veechau veechau force-pushed the ronan-veronica/add-optional-api-key-param-for-requests branch from 76f3448 to 13afc09 Compare November 30, 2018 22:59
@veechau veechau force-pushed the ronan-veronica/add-optional-api-key-param-for-requests branch from 13afc09 to 4c15e30 Compare November 30, 2018 23:31
@@ -61,6 +61,8 @@ def self.api_url(path='')
end

def self.request(method, path, params={}, headers={})
api_key = headers.key?(:api_key) ? headers.delete(:api_key) : @api_key
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to delete the key?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to set this as different param

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I caused confusion with the usage of 'param' here. Ideally I wanted to see it in another argument. Given complexity for this, and that's it's been implemented like this (using headers) in other public gem, I'm ok with it.

@veechau
Copy link
Contributor Author

veechau commented Dec 5, 2018

Closing due to #53

@veechau veechau closed this Dec 5, 2018
@veechau veechau deleted the ronan-veronica/add-optional-api-key-param-for-requests branch December 5, 2018 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants