-
Notifications
You must be signed in to change notification settings - Fork 52
Support API calls for several cities #27
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
Conversation
Integration tests: - cities returns a result - cities returns an array API tests: - cities with valid IDs returns 200 - cities with invalid IDs returns 404
API: - current cities invalid - current cities valid Integration: - current by cities
Add an optional URL parameter to retrieve and send_request to use instead of the class URL (in the case of queries to multiple cities at once, the URL differs from the regular `current` queries).
Also refactor the comma-separated encoding of arrays in a private function.
Including cassettes for tests: API: - Current weather for a valid rectangle zone - Current weather for an invalid rectangle zone Integration: - Current weather for a rectangle zone
API tests: - Current valid circle zone - Current invalid circle zone Integration tests: - Current circle zone
The circle zone API calls returns `count` instead of the usual `cnt`, so it felt weird to have only this test with a different name for the list count. Following the convention of the code around, used the count of items in `list` instead.
|
Had a quick look, looks good to me. I will take a detailed look tonight. @42races, can you review this pull request as well. |
|
@coderhs I was wondering if you had time to take a detailed look? Not that it is pressing, but I would rather point to this repo in my dependencies rather than my fork. No rush, merely waiting for a followup whenever you will have time. Thanks! 😄 |
|
@JesseEmond sorry about the delay, merging this request, and will release the new gem soon. Probably tomorrow. |
Support API calls for several cities
As per issue #23, this adds support for the 3 API calls to get the weather for several cities at once:
cities: from a list of city IDsrectangle_zone: from a bounding boxcircle_zone: from a point and a count of cities to returnThese only apply to
Current, so I added class methods inapi.rb(SeveralCitiesClassMethods) and then extendCurrentto get them.I added an optional parameter to
retrieveandsend_requestto add the possibility to "force" a different URL than the one specified by the class (in this case, the 3 URLs are different than the usualCurrentbase URL).I figured I would bump up the version number to
0.12.0, as this adds to the API.Please let me know if I should change anything or if you have ideas on how to improve this PR. Thank you!