-
Notifications
You must be signed in to change notification settings - Fork 3
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
API Version 3 Support #6
Comments
@cescue those three ideas make sense to me. the first one seems susceptible to ambiguity, and i'd like to keep the Ruby method names as close as possible to the REST endpoint names. the third one is the closest to what i have in mind. i do indeed have a plan, but it is not set in stone, and it would be great to get some feedback before i start implementing. the basic idea is to use the
so usage would look something like: # V2 methods by default
Surveymonkey.get_surveys
#=> list of surveys
# V3 methods on demand
Surveymonkey::API::version = 3
Surveymonkey.surveys
#=> list of surveys
Surveymonkey.surveys(id: XXXXX, details: true)
#=> specific survey with details or alternately $ export SURVEYMONKEY_API_VERSION=3 Surveymonkey.surveys
#=> list of surveys
Surveymonkey.get_surveys
#=> some kind of exception, ideally with a message about invalid API version thoughts? also, i would LOVE help with this. given my current workload it will be difficult to make this work a priority, but i really would like to be able to offer support for the new API (the old one is clunky in various ways). if you have any time/energy to devote to this task, i'm more interested in making sure that it's a project that's fun for you to work on than in making sure it's implemented in exactly the precise way that i would choose :) |
Your approach is much more thoroughly thought out than mine were, I like it. I'm assuming HTTP methods would be specified in options? For instance:
The solution I had in mind was to prefix the method call with the request type (this is shown in my first example, but I utterly failed to explain it - my bad):
I feel that this would make a better distinction between the API parameters and the HTTP request itself, but it might be more work than it's worth. And come to think of it, |
hmmmmmmmmmmmmmmmm. i need to look a bit harder at the APIv3 specification; my naïve assumption is that it should be possible to derive from context (i.e. from which parameters are passed in) what HTTP method should be used, but i could easily be mistaken. however: i'm creating an initial milestone which will consist of just moving the current then once there's space to make |
I haven't been able to dedicate time for experimentation with version 3, but it looks support will need to be added for the gem to continue functioning. Here's an excerpt from an email Surveymonkey recently sent out:
|
I've had to give up after a few attempts of porting this project to version 3 - The API is just too different. I'm hoping you'll have more success with it if you end up giving it a shot. If you end up needing a ruby client for version 3, I'm building a new one from scratch right now - it's still very early in development (and nowhere near as sophisticated as this one), but it should work out of the box with version 3. https://github.com/cescue/monkey-business Cheers! |
@cescue |
I'd like to see what it would take to add support for the version 3 API while retaining backward compatibility (e.g. defaulting to version 2). If support were added, how do you see the user specifying which version to use? There are three reasonable (I think) approaches that I could come up with.
Option 1 - API version is derived from the methods themselves:
Option 2 - Use existing methods where applicable, and specify v3 using an additional option:
Option 3 - Use existing methods where applicable, and specify v3 by calling a scoped method before making API requests
I'd love to hear some feedback - did you already have a plan for this?
The text was updated successfully, but these errors were encountered: