Support API calls for several cities#27
Merged
coderhs merged 13 commits intocoderhs:masterfrom Oct 9, 2015
Merged
Conversation
added 13 commits
September 3, 2015 12:45
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.
Owner
|
Had a quick look, looks good to me. I will take a detailed look tonight. @42races, can you review this pull request as well. |
Contributor
Author
|
@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! 😄 |
Owner
|
@JesseEmond sorry about the delay, merging this request, and will release the new gem soon. Probably tomorrow. |
coderhs
added a commit
that referenced
this pull request
Oct 9, 2015
Support API calls for several cities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!