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/0.27.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRut committed Feb 15, 2021
2 parents 9710908 + 6821aed commit dd27d27
Show file tree
Hide file tree
Showing 11 changed files with 643 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [v0.27.0](https://github.com/SebRut/pygrocy/tree/v0.27.0) (2021-02-15)

[Full Changelog](https://github.com/SebRut/pygrocy/compare/v0.26.0...v0.27.0)

**Merged pull requests:**

- add tests for meal plan && change MealItem to only fetch recipe when … [\#150](https://github.com/SebRut/pygrocy/pull/150) ([SebRut](https://github.com/SebRut))
- fix error if product has no barcodes [\#149](https://github.com/SebRut/pygrocy/pull/149) ([SebRut](https://github.com/SebRut))

## [v0.26.0](https://github.com/SebRut/pygrocy/tree/v0.26.0) (2021-02-13)

[Full Changelog](https://github.com/SebRut/pygrocy/compare/v0.25.0...v0.26.0)
Expand Down
15 changes: 11 additions & 4 deletions pygrocy/data_models/meal_items.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import base64
from datetime import datetime

from pygrocy.base import DataModel
from pygrocy.grocy_api_client import RecipeDetailsResponse, MealPlanResponse, GrocyApiClient
from pygrocy.grocy_api_client import (
GrocyApiClient,
MealPlanResponse,
RecipeDetailsResponse,
)


class RecipeItem(DataModel):
Expand Down Expand Up @@ -49,6 +54,7 @@ class MealPlanItem(DataModel):
def __init__(self, response: MealPlanResponse):
self._id = response.id
self._day = response.day
self._recipe = None
self._recipe_id = response.recipe_id
self._recipe_servings = response.recipe_servings
self._note = response.note
Expand Down Expand Up @@ -78,6 +84,7 @@ def recipe(self) -> RecipeItem:
return self._recipe

def get_details(self, api_client: GrocyApiClient):
recipe = api_client.get_recipe(self.recipe_id)
if recipe:
self._recipe = RecipeItem(recipe)
if self.recipe_id:
recipe = api_client.get_recipe(self.recipe_id)
if recipe:
self._recipe = RecipeItem(recipe)
2 changes: 1 addition & 1 deletion pygrocy/data_models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _init_empty(self):
self._available_amount = None
self._best_before_date = None

self._barcodes = None
self._barcodes = []
self._product_group_id = None

def _init_from_CurrentStockResponse(self, response: CurrentStockResponse):
Expand Down
4 changes: 1 addition & 3 deletions pygrocy/grocy_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def __init__(self, parsed_json):

def _parse_barcodes(self, parsed_json):
barcodes_raw = parsed_json.get("product_barcodes", "")
if barcodes_raw is None:
self._barcodes = None
else:
if barcodes_raw is not None:
self._barcodes = [ProductBarcode(barcode) for barcode in barcodes_raw]

def _parse_location(self, parsed_json):
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="0.26.0",
version="0.27.0",
author="Sebastian Rutofski",
author_email="[email protected]",
description="",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interactions:
- request:
body: null
headers:
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- python-requests/2.25.1
accept:
- application/json
method: GET
uri: https://localhost/api/objects/meal_plan
response:
body:
string: !!binary |
H4sIAAAAAAAEA9WVyw6CMBBFf4V0DaYFn3yHO2NIQ6s24WVpNcb4784oKEjSpUkTFpNpb5kDd6a7
O1GCpISRkAh+gyimMYtoHNE1pMytkZDTMlcQhF2QfSTvhayV+qKqY9sdVNUGVJUtipA0uhY2Ny/J
OMPL2lYGJHRG4eh+49kO9ur6muVaciNFZlQpW8PLZlAkSwK2SecsTZZwhIU6DkoWAgrBdz3Cji6G
xR+6DaRcdCjxhC6Z0DH8oC46lHhCN5/SoVlddCjxhG4xpUPnueiQ3hM6bMpx3zF0novOo75bTenQ
eS46j5yJ43/87+hgZr5G/MeHeB+8h7vLmGR7Um0ADw86eT/zv/o+84fLYf8E8//2HPwGAAA=
headers:
Access-Control-Allow-Headers:
- '*'
Access-Control-Allow-Methods:
- GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:
- '*'
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Mon, 15 Feb 2021 15:38:19 GMT
Server:
- nginx/1.18.0
Transfer-Encoding:
- chunked
X-Powered-By:
- PHP/7.4.14
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit dd27d27

Please sign in to comment.