Skip to content

Commit

Permalink
Merge pull request #240 from p0lycarpio/main
Browse files Browse the repository at this point in the history
add `store_picture` variable
  • Loading branch information
Der-Henning authored Jan 26, 2023
2 parents 4c6f7f0 + 23ef9f3 commit 584613f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
- IFTTT_BODY= ## IFTTT json data body
## Default: {"value1": "$${{display_name}}", "value2": $${{items_available}}, "value3": "https://share.toogoodtogo.com/item/$${{item_id}}"}

## Possible $${{variable}} variables: item_id, items_available, display_name, price, currency, pickupdate
## Possible $${{variable}} variables: item_id, items_available, display_name, price, currency, pickupdate, item_logo, item_cover
## Link to item in App: https://share.toogoodtogo.com/item/${{item_id}}
## Example:
## - 'WEBHOOK_BODY={"message": "$${{display_name}} - New Amount: $${{items_available}}", "priority": 2, "title": "New TGTG Items"}'
Expand Down
9 changes: 8 additions & 1 deletion src/models/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ATTRS = ["item_id", "items_available", "display_name", "description",
"price", "currency", "pickupdate", "favorite", "rating",
"buffet", "item_category", "item_name", "packaging_option",
"pickup_location", "store_name"]
"pickup_location", "store_name", "item_logo", "item_cover"]


class Item():
Expand Down Expand Up @@ -41,6 +41,13 @@ def __init__(self, data: dict):
10**price_including_taxes.get("decimals", 0))
self.price = f"{self.price:.2f}"
self.currency = item.get("price_including_taxes", {}).get("code", "-")
self.item_logo = item.get("logo_picture", {}).get(
"current_url",
"https://tgtg-mkt-cms-prod.s3.eu-west-1.amazonaws.com/"
"13512/TGTG_Icon_White_Cirle_1988x1988px_RGB.png")
self.item_cover = item.get("cover_picture", {}).get(
"current_url",
"https://images.tgtg.ninja/standard_images/GENERAL/other1.jpg")

store = data.get("store", {})
self.store_name = store.get("name", "-")
Expand Down

0 comments on commit 584613f

Please sign in to comment.