-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscooter_position_log.py
31 lines (29 loc) · 1.07 KB
/
scooter_position_log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from datetime import datetime
import json
class ScooterPositionLog():
def __init__(self, vehicle_id: str, lat: float, lng: float, raw_data: str, provider: str, city: str,
secondary_id: str = None, licence_plate: str = None, timestamp: datetime = datetime.now(),
battery_level=None):
self.city = city
self.provider = provider
self.id = vehicle_id
self.secondary_id = secondary_id
self.lat = lat
self.lng = lng
self.timestamp = timestamp
self.battery_level = battery_level
self.licence_plate = licence_plate
self.raw_data = raw_data
def to_dict(self):
return {
'city': self.city,
'provider': self.provider,
'id': self.id,
'secondary_id': self.secondary_id,
'lat': self.lat,
'lng': self.lng,
'timestamp': self.timestamp,
'battery_level': self.battery_level,
'licence_plate': self.licence_plate,
'raw_data': json.dumps(self.raw_data)
}