Skip to content

Conversation

@JesseEmond
Copy link
Contributor

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 IDs
  • rectangle_zone: from a bounding box
  • circle_zone: from a point and a count of cities to return

These only apply to Current, so I added class methods in api.rb (SeveralCitiesClassMethods) and then extend Current to get them.

I added an optional parameter to retrieve and send_request to 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 usual Current base 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!

Jesse Emond 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.
@coderhs
Copy link
Owner

coderhs commented Sep 4, 2015

Had a quick look, looks good to me. I will take a detailed look tonight. @42races, can you review this pull request as well.

@JesseEmond
Copy link
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! 😄

@coderhs
Copy link
Owner

coderhs commented Oct 9, 2015

@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
@coderhs coderhs merged commit 2a1fcf0 into coderhs:master Oct 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants