88ResourceData = dict [str , Any ]
99
1010
11- class Model :
11+ class Model : # noqa: WPS214
1212 """Provides a resource to interact with api data using fluent interfaces."""
1313
1414 _data_key : ClassVar [str | None ] = None
15- _safe_attributes : ClassVar [list [str ]] = ["meta" , "_resource_data " ]
15+ _safe_attributes : ClassVar [list [str ]] = ["meta" , "_box " ]
1616
1717 def __init__ (self , resource_data : ResourceData | None = None , meta : Meta | None = None ) -> None :
1818 self .meta = meta
19- self ._resource_data = Box (resource_data or {}, camel_killer_box = True , default_box = False )
19+ self ._box = Box (resource_data or {}, camel_killer_box = False , default_box = False )
2020
2121 @classmethod
2222 def new (cls , resource_data : ResourceData | None = None , meta : Meta | None = None ) -> Self :
@@ -25,15 +25,15 @@ def new(cls, resource_data: ResourceData | None = None, meta: Meta | None = None
2525
2626 def __getattr__ (self , attribute : str ) -> Box | Any :
2727 """Returns the resource data."""
28- return self ._resource_data .__getattr__ (attribute ) # type: ignore[no-untyped-call]
28+ return self ._box .__getattr__ (attribute ) # type: ignore[no-untyped-call]
2929
3030 @override
3131 def __setattr__ (self , attribute : str , attribute_value : Any ) -> None :
3232 if attribute in self ._safe_attributes :
3333 object .__setattr__ (self , attribute , attribute_value )
3434 return
3535
36- self ._resource_data .__setattr__ (attribute , attribute_value ) # type: ignore[no-untyped-call]
36+ self ._box .__setattr__ (attribute , attribute_value ) # type: ignore[no-untyped-call]
3737
3838 @classmethod
3939 def from_response (cls , response : Response ) -> Self :
@@ -55,8 +55,12 @@ def from_response(cls, response: Response) -> Self:
5555 @property
5656 def id (self ) -> str :
5757 """Returns the resource ID."""
58- return str (self ._resource_data .get ("id" , "" )) # type: ignore[no-untyped-call]
58+ return str (self ._box .get ("id" , "" )) # type: ignore[no-untyped-call]
5959
6060 def to_dict (self ) -> dict [str , Any ]:
6161 """Returns the resource as a dictionary."""
62- return self ._resource_data .to_dict ()
62+ return self ._box .to_dict ()
63+
64+ @override
65+ def __repr__ (self ) -> str :
66+ return f"<{ self .__class__ .__name__ } { self .id } >" # noqa: WPS237
0 commit comments