Publish the Rohlík Group shops; add cart currency and minimum order value (v0.3.0) - #11
Merged
Merged
Conversation
…alue Every Rohlík Group shop runs the same API, and RohlikAPI already took a base_url, but consumers each had to know the other shops' URLs themselves and the models documented every amount as CZK. - New rohlik_api.SITES / Site: code, name, base_url, currency and timezone for Rohlík.cz, Knuspr.de, Gurkerl.at, Kifli.hu and Sezamo.ro (#10). - CartItem.currency from each item's ISO currency code, and Cart.currency from its items (the cart payload itself has none; None for an empty cart) (#10). - Cart.minimum_order_price from minimalOrderPrice, which Cart.from_api used to drop (#9). Cart.can_make_order's docstring no longer claims it tracks the minimum: submitConditionPassed also needs checkout details. - Docstrings and README no longer assume CZK / Rohlik.cz only; README gains an "Other shops" section. Checked against live anonymous carts on knuspr.de (currency "EUR") and rohlik.cz ("CZK"); minimalOrderPrice is present there but 0, so the value on a logged-in cart is still to be confirmed. Closes #9 Closes #10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
Owner
Author
|
@claude review this PR. Focus on correctness bugs, backwards compatibility of the public models ( Generated by Claude Code |
|
Claude finished @dvejsada's task in 1m 54s —— View job Reviewing PR #11
ReviewOverall this is a clean, well-scoped change. I couldn't find a correctness bug in the new code paths. Backwards compatibility — looks solid
Correctness
Minor doc nit (non-blocking)
Not verified
No blocking issues found. The |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
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.
Closes #9. Closes #10.
Why
Every Rohlík Group shop runs the same API, and
RohlikAPIalready accepted abase_url. Even so, each consumer had to know the other shops' URLs itself, and the models described every amount as CZK. The Home Assistant integration just added shop selection (dvejsada/HA-RohlikCZ#92) and keeps its own copy of the shop table; it can use this one once it ships. Separately, the cart response contains the minimum order value, butCart.from_apidropped it (#9).Changes
rohlik_api.SITES/Site(Multi-shop support: publish the known Rohlík Group shop URLs and stop assuming CZK #10): a frozen dataclass withcode,name,base_url,currencyandtimezone, covering Rohlík.cz, Knuspr.de, Gurkerl.at, Kifli.hu and Sezamo.ro. Usage:RohlikAPI(user, pw, base_url=SITES["de"].base_url).CartItem.currency(Multi-shop support: publish the known Rohlík Group shop URLs and stop assuming CZK #10): read from each item'scurrencyfield, an ISO code such as"EUR".Cart.currency(Multi-shop support: publish the known Rohlík Group shop URLs and stop assuming CZK #10): taken from the items, because the cart payload has no currency field of its own. It isNonefor an empty cart.Cart.minimum_order_price(Feature request: expose the minimum order value (if the API returns it) #9): read fromminimalOrderPrice. It isNonewhen the field is absent.Cart.can_make_orderdocstring: it no longer claims to track the minimum order.submitConditionPassedalso depends on checkout details such as a chosen delivery slot.Verified against live responses
I added an item to an anonymous (logged-out) cart on knuspr.de and on rohlik.cz:
"currency": "EUR"and"CZK"respectively.minimalOrderPriceis present at the top level ofdata(along withminimalStandardOrderPriceandminimalDeliveryPointOrderPrice), but it is0on an anonymous cart.The value on a logged-in cart is not yet confirmed. The docstring states this.
Testing
ruff check .,black --check .andmypy rohlik_apipass.pytest: 152 passed.tests/test_sites.py: presets are well formed,czmatchesBASE_URL, the names are exported, and the client targets the chosen shop.🤖 Generated with Claude Code
https://claude.ai/code/session_0135WLPbnfESWnAJmw4P8uRH
Generated by Claude Code