Closed agrberg closed 2 years ago
I definitely prefer the former because the latter is an API change, and we should only do this very carefully. Options is exactly designed for those ... optional options :)
Next, the result of this is a single value? Should we just add a key_stat
method instead of having this one return two different types?
🤔 that's a great question. There's no reason that because IEX's API groups a single stat as a special case of all basic stats that the client need to do the same.
I think having a key_stat
endpoint solves all of the issues:
client.key_stat(symbol, stat, options)
key_stat
returns the data in the type of the choosen the stat.Rebased and updated ☝️
Merged. Thanks!
happy to give back 💪
Maybe time to cut a release?
Good idea. Just launched v 1.5.0 w/ the new endpoint 🎉
Alternatives I considered:
Keep the method signature the same and supplying the stat in the
options
hashWrap the single stat in a
IEX::Resources::KeyStats
instanceThis would keep the return type the same and with
nil
being provided for any of the other stats. E.g.:Let me know what you think!