Add zip code lookup with specs and VCR cassettes#45
Open
Gilmoursa wants to merge 1 commit into
Open
Conversation
- Add .zip class method to ClassMethods module (available on Current, Forecast, ForecastDaily, and History) - Add :zip to valid_options allowlist in Base so it isn't stripped before the API request is sent - Add spec context for .zip with valid (33704,US) and invalid (00000,US) cases, backed by VCR cassettes matching the existing cassette format - Move README example to the Current API section; fix "Doucumentation" typo Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
This supersedes #28 with the missing test coverage added.
Changes
lib/open_weather/api.rb— adds.ziptoClassMethods, making it available onCurrent,Forecast,ForecastDaily, andHistory:lib/open_weather/base.rb— adds:ziptovalid_optionsso the parameter isn't stripped before the API request is sent.spec/open_weather/api_spec.rb— adds a.zipcontext with two cases matching the style of every other method in the suite:33704,US) → expectscod: 20000000,US) → expectscod: '404'spec/fixtures/cassettes/api/— addscurrent_zip_valid.ymlandcurrent_zip_invalid.ymlVCR cassettes in the existing format.README.md— moves the zip example into the Current API section (where the other single-location lookups live) and fixes a pre-existing "Doucumentation" typo.Test plan
bundle exec rspec spec/open_weather/api_spec.rb— all existing tests pass, two new.ziptests pass🤖 Generated with Claude Code