Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRut committed Apr 23, 2024
2 parents 9b9bd71 + cbf100a commit 679dca2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## [v2.1.0](https://github.com/SebRut/pygrocy/tree/v2.1.0) (2024-04-23)

**THIS IS WILL PROBABLY BE THE LAST pygrocy RELEASE, THE LIBRARY WILL GO INTO UNMAINTAINED STATE**

[Full Changelog](https://github.com/SebRut/pygrocy/compare/v2.0.0...v2.1.0)

**Closed issues:**

- Add support for grocy api via reverse proxies [\#276](https://github.com/SebRut/pygrocy/issues/276)
- getting error when running code [\#274](https://github.com/SebRut/pygrocy/issues/274)
- Getting product by id fails if name\_plural is null [\#271](https://github.com/SebRut/pygrocy/issues/271)
- Support for Grocy 4.0 API [\#266](https://github.com/SebRut/pygrocy/issues/266)

**Merged pull requests:**

- Add amount field to ProductBarcode [\#278](https://github.com/SebRut/pygrocy/pull/278) ([looching](https://github.com/looching))
- use value prop in delete API call [\#273](https://github.com/SebRut/pygrocy/pull/273) ([jeremy-green](https://github.com/jeremy-green))
- Make plural name optional for Quantity Units [\#272](https://github.com/SebRut/pygrocy/pull/272) ([vorostamas](https://github.com/vorostamas))

## [v2.0.0](https://github.com/SebRut/pygrocy/tree/v2.0.0) (2023-08-17)

[Full Changelog](https://github.com/SebRut/pygrocy/compare/v1.5.0...v2.0.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**This project is de-facto unmaintained as haven't been using grocy for a while. Feel free to fork and create pygrocy2!**

# pygrocy
[![Development Build Status](https://api.travis-ci.com/SebRut/pygrocy.svg?branch=develop)](https://travis-ci.com/SebRut/pygrocy)
[![PyPI](https://img.shields.io/pypi/v/pygrocy.svg)](https://pypi.org/project/pygrocy/)
Expand Down
7 changes: 6 additions & 1 deletion pygrocy/data_models/product.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import List
from typing import List, Optional

from pygrocy.base import DataModel
from pygrocy.grocy_api_client import (
Expand All @@ -19,11 +19,16 @@
class ProductBarcode(DataModel):
def __init__(self, data: ProductBarcodeData):
self._barcode = data.barcode
self._amount = float(data.amount) if data.amount else None

@property
def barcode(self) -> str:
return self._barcode

@property
def amount(self) -> Optional[float]:
return self._amount


class QuantityUnit(DataModel):
def __init__(self, data: QuantityUnitData):
Expand Down
2 changes: 1 addition & 1 deletion pygrocy/grocy.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def update_generic(self, entity_type: EntityType, object_id: int, updated_data):
)

def delete_generic(self, entity_type: EntityType, object_id: int):
return self._api_client.delete_generic(entity_type, object_id)
return self._api_client.delete_generic(entity_type.value, object_id)

def get_generic_objects_for_type(
self, entity_type: EntityType, query_filters: List[str] = None
Expand Down
3 changes: 2 additions & 1 deletion pygrocy/grocy_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class RecipeDetailsResponse(BaseModel):
class QuantityUnitData(BaseModel):
id: int
name: str
name_plural: str
name_plural: Optional[str] = None
description: Optional[str] = None
row_created_timestamp: datetime

Expand Down Expand Up @@ -161,6 +161,7 @@ class CurrentVolatilStockResponse(BaseModel):

class ProductBarcodeData(BaseModel):
barcode: str
amount: Optional[float] = None


class ProductDetailsResponse(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pygrocy",
version="2.0.0",
version="2.1.0",
author="Sebastian Rutofski",
author_email="[email protected]",
description="",
Expand Down

0 comments on commit 679dca2

Please sign in to comment.