diff --git a/src/asquare.py b/src/asquare.py index a963139..36ec42e 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -55,10 +55,14 @@ async def update_itm(lego_set: dict): """ Asynchronously updates an item in the Square catalog based on the provided LEGO set information. Args: - lego_set (dict): A dictionary containing LEGO set details. Expected keys include: - - "sets": List of set dictionaries, each with "name", "number", "barcode" (with "UPC"), and "image" (with "thumbnailURL"). - - "pw_name": The name associated with the LEGO set in another system. - - "set_adjustredprice": The adjusted price for the set. + lego_set (dict): A dictionary containing LEGO set details from abricksetapi. Expected keys include: + - "set_num": LEGO set number (e.g., "75192") + - "set_name": Official LEGO set name + - "set_theme": LEGO theme (e.g., "Star Wars") + - "set_barcode": UPC barcode + - "set_image": Thumbnail URL + - "pw_name": Formatted name for Square inventory (e.g., "75192 - STAR WARS UCS Millennium Falcon") + - "set_adjustredprice": Retail price with 10% markup applied Returns: bool: True if the update operation was successful. Raises: @@ -66,10 +70,10 @@ async def update_itm(lego_set: dict): Exception: For errors during Square API interaction. """ - set_name = lego_set["sets"][0]["name"] - set_number = lego_set["sets"][0]["number"] - set_upc = lego_set["sets"][0]["barcode"]["UPC"] - set_image = lego_set["sets"][0]["image"]["thumbnailURL"] + set_number = lego_set["set_num"] + set_name = lego_set["set_name"] + set_upc = lego_set["set_barcode"] + set_image = lego_set["set_image"] pw_name = lego_set["pw_name"] set_adjustedprice = lego_set["set_adjustredprice"]