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

Add a configuration value for API version #4

Open
jaredmoody opened this issue Oct 31, 2018 · 2 comments
Open

Add a configuration value for API version #4

jaredmoody opened this issue Oct 31, 2018 · 2 comments
Assignees

Comments

@jaredmoody
Copy link
Contributor

jaredmoody commented Oct 31, 2018

According to the documentation, the way to specify the specific API version you want is with an accept header like: "application/vnd.connectwise.com+json; version=3.0.0"

Currently I'm doing this to set it:

ConnectWise::ApiClient.default.default_headers['Accept'] = "application/vnd.connectwise.com+json; version=3.0.0"

but it would be nice if I could just pass the version in the configuration block like so:

ConnectWise.configure do |config|
  config.api_version = '3.0.0'
end

What do you think about adding that? I'd be happy to submit a PR if you like the idea.

@jaredmoody
Copy link
Contributor Author

I tagged the wrong issue in my commit - this is still unresolved, can you re-open? However, perhaps a different approach to the issue would be better here:

Since the fields that are passed to the CW API are all explicitly defined, you really can't use this library with new API versions like 3.0.1 - at least you can't pass any of the new fields defined.

Instead of allowing configuration of the API version, since this library is tied to 3.0.0 (unless a major update is made), perhaps should be added "application/vnd.connectwise.com+json; version=3.0.0" as the default Accepts header for all requests.

@sowderca sowderca reopened this Nov 2, 2018
@sowderca
Copy link
Owner

@jaredmoody I've thought some more about this and I think that your idea of defaulting the Accepts header to mirror the version of the API that the models were generated from is the best solution. According to the documentation the API will attempt to convert the endpoint to the new mode which should help with usability. I also noticed that they have moved where the OpenAPI specification files were stored which was causing the gem's models to be a bit outdated. I'll push an update here in a minute using the new specs.

@sowderca sowderca self-assigned this Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants