Added PlatformType and PlatformTypeType (for #4)
This commit is contained in:
@@ -3,6 +3,7 @@ from .gis import Gis
|
||||
from .journey import Journey
|
||||
from .leg import Leg
|
||||
from .message import Channel, Message, Url
|
||||
from .platform_type import PlatformType
|
||||
from .stop import Stop, StopTrip
|
||||
from .ticket import Ticket
|
||||
from .trip import Trip
|
||||
|
17
src/pyrmv/classes/platform_type.py
Normal file
17
src/pyrmv/classes/platform_type.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from typing import Any, Mapping, Union
|
||||
|
||||
from pyrmv.enums.platform_type_type import PlatformTypeType
|
||||
|
||||
|
||||
class PlatformType:
|
||||
"""Platform information."""
|
||||
|
||||
def __init__(self, data: Mapping[str, Any]):
|
||||
self.type: PlatformTypeType = (
|
||||
PlatformTypeType.U if "type" not in data else PlatformTypeType(data.get("type"))
|
||||
)
|
||||
self.text: Union[str, None] = data.get("text")
|
||||
self.hidden: bool = bool(data.get("hidden"))
|
||||
self.lon: float = data["lon"]
|
||||
self.lat: float = data["lat"]
|
||||
self.alt: int = data["alt"]
|
Reference in New Issue
Block a user