You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds generic fetch_vertical method and re-organizes code structure (#57)
Closes#48
## `fetch_vertical`
- Takes in a `vertical`, `request_params` for to be sent in the actual
HTTP request, and `params`, which are optional key-word arguments
specific to each method.
- Works by using the vertical's plural name to generate the method name
and calling that with the latter two arguments described above. May seem
a little risky to call a method based on a name, but given that we check
if the vertical is supported and generate the method names based on the
vertical names, I think it should be okay (and I wrote tests). As
always, open to feedback!
- For the sake of consistency, I added a `request_params` argument to
every `fetch_` method (which I think is smart anyway since our pardners
may want fine-grained configurability and may have familiarity with the
APIs).
## Exception reorganization
- Moved all exception definitions from `services/base.py` to
`exceptions.py`
- Made the list arguments in the exceptions constructors optionally
lists to get around having to generate one element lists to raise the
exception.
## Misc
- Made helper method (`is_vertical_supported(...)`) for checking if a
vertical is supported using `_supported_verticals` since it's not
unexpected that our pardners may want to check before adding a vertical
- Renamed `fetch_athlete_activities(...)` to
`fetch_physical_activities(...)` for consistency
- Moved `request_params` to be first argument in all the `fetch_`
methods.
0 commit comments