-
Notifications
You must be signed in to change notification settings - Fork 28
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
Rewrite get_data #38
Comments
while at it, I recommend renaming it to simply 'data' per ruby conventions. (the get/set_X is less popular in ruby) |
I was looking into it and it is actually using hash. There is a difference between def get_data(id, starts: nil, ends: nil, bucketDuration: nil, buckets: nil, percentiles: nil, limit: nil, order: nil) and def get_data(id, starts = nil, ends = nil, bucketDuration = nil, buckets = nil, percentiles = nil, limit = nil, order = nil) Both methods takes the id as a first param. The difference here is that the second method can accept optional parameters, but it's an ordered list, so if I wan't to specify, say, The second signature is different, the order doesn't matter, because technically the method accept an id and a hash. I can call the first method as get_data(42, starts: now - (2 *foo), ends: now - foo) or even additional_params = {
start: foo,
end: bar,
order: baz
}
get_data(42, additional_params) note: Ruby doesn't allow to call the 2nd method this way So i think, we are good here as for the hash and passing the arguments. Correct, me if I am wrong or missing something. So what about the |
Oh, and it's Ruby 2+ feature, but it shouldn't be the issue (https://robots.thoughtbot.com/ruby-2-keyword-arguments) |
So I hear you saying @Jiri-Kremser this is no issue and already works? If so, could you add some tests please that use this alternate style to make sure it continues to work in the future? |
this was the original: def get_data(id, starts: nil, ends: nil, bucketDuration: nil, buckets: nil) and this is the new version: def get_data(id, starts: nil, ends: nil, bucketDuration: nil, buckets: nil, percentiles: nil, limit: nil, order: nil) This is not a breaking change. I think, it's well tested (https://git.io/vrJIm) but I can add a case for |
@abonas "So what about the get_data -> data renaming, does it worth to break the api?" |
@pilhuhn regarding breaking the api - it depends how many users the ruby client has. if only 1 and we know who, and it's one place to rename - I'd go ahead and rename it. |
As discussed in #36 the current impl's set of parameters is overloaded and we should rewrite to pass all optional params in a hash.
The text was updated successfully, but these errors were encountered: