Renaming Maintenance to comply with others & fix the api return values

This commit is contained in:
Maxime Liege
2023-12-19 22:43:31 +01:00
parent 6037d30721
commit fa0d340437
3 changed files with 32 additions and 24 deletions

View File

@@ -4,7 +4,7 @@ import logging
_LOGGER = logging.getLogger(__name__)
class GeorideMaintenance:
class GeoRideMaintenance:
def __init__(self,
name,
@@ -75,18 +75,26 @@ class GeorideMaintenance:
"lastMaintenanceDistance": self.lastMaintenanceDistance
}).encode("utf-8")
def to_date_maintenance_json(self):
return json.dumps({
"name": self.name,
"everyMaintenance": self.everyMaintenance,
"lastMaintenanceDate": self.lastMaintenanceDate,
"dateUnitType": self.dateUnitType
}).encode("utf-8")
@staticmethod
def from_json(json):
def from_json(json_obj):
"""return new object fromjson"""
return GeorideMaintenance(
name=json['name'],
id=json['id'],
todo=json['todo'],
trackerId=json['trackerId'],
lastMaintenanceDistance=json['lastMaintenanceDistance'],
lastMaintenanceDate=json['lastMaintenanceDate'],
dateUnitType=json['dateUnitType'],
everyMaintenance=json['everyMaintenance'],
createdAt=json['createdAt'],
updatedAt=json['updatedAt']
return GeoRideMaintenance(
name=json_obj['name'],
id=json_obj['id'],
todo=json_obj['todo'],
trackerId=json_obj['trackerId'],
lastMaintenanceDistance=json_obj['lastMaintenanceDistance'],
lastMaintenanceDate=json_obj['lastMaintenanceDate'],
dateUnitType=json_obj['dateUnitType'],
everyMaintenance=json_obj['everyMaintenance'],
createdAt=json_obj['createdAt'],
updatedAt=json_obj['updatedAt']
)

View File

@@ -8,5 +8,5 @@ from .GeoRideTrackerBeacon import *
from .GeoRideTrackerPosition import *
from .GeoRideTrackerTrip import *
from .GeoRideUser import *
from .GeorideMaintenance import *
from .GeoRideMaintenance import *