Skip to content

Commit

Permalink
Merge pull request #8 from CrazyProger1/dev
Browse files Browse the repository at this point in the history
0.0.4
  • Loading branch information
CrazyProger1 authored Apr 25, 2024
2 parents 1a57172 + cf8233b commit 3084093
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async def main():

## Status

``0.0.3`` - **RELEASED**
``0.0.4`` - **RELEASED**

## Licence

Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
- Added URL injecting mechanism (allows to perform many-layer requests: `api/v1/users/123/product/321`).
See [example](../examples/crud_many_layers)
- Added deserialize_many serializer method

## v0.0.4

- Manager fixes
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "resty-client"
version = "0.0.3"
version = "0.0.4"
description = "RestyClient is a simple, easy-to-use Python library for interacting with REST APIs using Pydantic's powerful data validation and deserialization tools."
authors = ["CrazyProger1 <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions resty/managers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _deserialize(cls, data: list | dict, many: bool = False, **options):

@classmethod
async def create(
cls, client: BaseRESTClient, obj: BaseModel, **kwargs
cls, client: BaseRESTClient, obj: BaseModel, **kwargs
) -> BaseModel:

set_pk = kwargs.pop("set_pk", True)
Expand Down Expand Up @@ -134,7 +134,7 @@ async def read_one(cls, client: BaseRESTClient, pk: any, **kwargs) -> BaseModel:
@classmethod
async def update(cls, client: BaseRESTClient, obj: BaseModel, **kwargs) -> None:
options = cls._prepare_options(
endpoint=Endpoint.READ, method=Method.GET, pk=cls._get_pk(obj), **kwargs
endpoint=Endpoint.UPDATE, method=Method.PATCH, pk=cls._get_pk(obj), **kwargs
)

options["json"] = cls._serialize(obj=obj, **options)
Expand All @@ -144,7 +144,7 @@ async def update(cls, client: BaseRESTClient, obj: BaseModel, **kwargs) -> None:
@classmethod
async def delete(cls, client: BaseRESTClient, pk: any, **kwargs) -> None:
options = cls._prepare_options(
endpoint=Endpoint.READ, method=Method.GET, pk=pk, **kwargs
endpoint=Endpoint.DELETE, method=Method.DELETE, pk=pk, **kwargs
)

await cls._make_request(client=client, **options)

0 comments on commit 3084093

Please sign in to comment.