|
|
@ -4,219 +4,10 @@ Georide objects implementation
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from . import JsonMgtMetaClass, GeoRideSubscription
|
|
|
|
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class JsonMgtMetaClass(type):
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def json_field_protect(json, field_name, default_value = None):
|
|
|
|
|
|
|
|
return json[field_name] if field_name in json.keys() else default_value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideSharedTrip:
|
|
|
|
|
|
|
|
""" Shared trip object representation """
|
|
|
|
|
|
|
|
def __init__(self, url, shareId):
|
|
|
|
|
|
|
|
self._url = url
|
|
|
|
|
|
|
|
self._share_id = shareId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def url(self):
|
|
|
|
|
|
|
|
""" shared trip url """
|
|
|
|
|
|
|
|
return self._url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def share_id(self):
|
|
|
|
|
|
|
|
""" shared trip id """
|
|
|
|
|
|
|
|
return self._share_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def from_json(json):
|
|
|
|
|
|
|
|
"""return new object fromjson"""
|
|
|
|
|
|
|
|
return GeoRideSharedTrip(
|
|
|
|
|
|
|
|
json['url'],
|
|
|
|
|
|
|
|
json['shareId']
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideTrackerTrip: # pylint: disable=too-many-instance-attributes
|
|
|
|
|
|
|
|
""" Trip object representation """
|
|
|
|
|
|
|
|
def __init__(self, trip_id, tracker_id, average_speed, max_speed, distance, duration, # pylint: disable=R0914, R0913
|
|
|
|
|
|
|
|
start_address, nice_start_address, start_lat, start_lon, end_address,
|
|
|
|
|
|
|
|
nice_end_address, end_lat, end_lon, start_time, end_time):
|
|
|
|
|
|
|
|
self._trip_id = trip_id
|
|
|
|
|
|
|
|
self._tracker_id = tracker_id
|
|
|
|
|
|
|
|
self._average_speed = average_speed
|
|
|
|
|
|
|
|
self._max_speed = max_speed
|
|
|
|
|
|
|
|
self._distance = distance
|
|
|
|
|
|
|
|
self._duration = duration
|
|
|
|
|
|
|
|
self._start_address = start_address
|
|
|
|
|
|
|
|
self._nice_start_address = nice_start_address
|
|
|
|
|
|
|
|
self._start_lat = start_lat
|
|
|
|
|
|
|
|
self._start_lon = start_lon
|
|
|
|
|
|
|
|
self._end_address = end_address
|
|
|
|
|
|
|
|
self._nice_end_address = nice_end_address
|
|
|
|
|
|
|
|
self._end_lat = end_lat
|
|
|
|
|
|
|
|
self._end_lon = end_lon
|
|
|
|
|
|
|
|
self._start_time = start_time
|
|
|
|
|
|
|
|
self._end_time = end_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def trip_id(self):
|
|
|
|
|
|
|
|
"""trip_id """
|
|
|
|
|
|
|
|
return self._trip_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def tracker_id(self):
|
|
|
|
|
|
|
|
""" tracker_id """
|
|
|
|
|
|
|
|
return self._tracker_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def average_speed(self):
|
|
|
|
|
|
|
|
""" average_speed """
|
|
|
|
|
|
|
|
return self._average_speed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def max_speed(self):
|
|
|
|
|
|
|
|
""" max_speed """
|
|
|
|
|
|
|
|
return self._max_speed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def distance(self):
|
|
|
|
|
|
|
|
""" distance """
|
|
|
|
|
|
|
|
return self._distance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def duration(self):
|
|
|
|
|
|
|
|
""" duration """
|
|
|
|
|
|
|
|
return self._duration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def start_address(self):
|
|
|
|
|
|
|
|
""" start_address """
|
|
|
|
|
|
|
|
return self._start_address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def nice_start_address(self):
|
|
|
|
|
|
|
|
""" nice_start_address """
|
|
|
|
|
|
|
|
return self._nice_start_address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def start_lat(self):
|
|
|
|
|
|
|
|
""" start_lat """
|
|
|
|
|
|
|
|
return self._start_lat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def start_lon(self):
|
|
|
|
|
|
|
|
""" start_lon """
|
|
|
|
|
|
|
|
return self._start_lon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def end_address(self):
|
|
|
|
|
|
|
|
""" end_address """
|
|
|
|
|
|
|
|
return self._end_address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def nice_end_address(self):
|
|
|
|
|
|
|
|
""" nice_end_address """
|
|
|
|
|
|
|
|
return self._nice_end_address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def end_lat(self):
|
|
|
|
|
|
|
|
"""end_lat """
|
|
|
|
|
|
|
|
return self._end_lat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def end_lon(self):
|
|
|
|
|
|
|
|
"""end_lon """
|
|
|
|
|
|
|
|
return self._end_lon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def start_time(self):
|
|
|
|
|
|
|
|
""" start_time """
|
|
|
|
|
|
|
|
return self._start_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def end_time(self):
|
|
|
|
|
|
|
|
""" end_time """
|
|
|
|
|
|
|
|
return self._end_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def from_json(json):
|
|
|
|
|
|
|
|
"""return new object from json"""
|
|
|
|
|
|
|
|
return GeoRideTrackerTrip(
|
|
|
|
|
|
|
|
json['id'],
|
|
|
|
|
|
|
|
json['trackerId'],
|
|
|
|
|
|
|
|
json['averageSpeed'],
|
|
|
|
|
|
|
|
json['maxSpeed'],
|
|
|
|
|
|
|
|
json['distance'],
|
|
|
|
|
|
|
|
json['duration'],
|
|
|
|
|
|
|
|
json['startAddress'],
|
|
|
|
|
|
|
|
json['niceStartAddress'],
|
|
|
|
|
|
|
|
json['startLat'],
|
|
|
|
|
|
|
|
json['startLon'],
|
|
|
|
|
|
|
|
json['endAddress'],
|
|
|
|
|
|
|
|
json['niceEndAddress'],
|
|
|
|
|
|
|
|
json['endLat'],
|
|
|
|
|
|
|
|
json['endLon'],
|
|
|
|
|
|
|
|
json['startTime'],
|
|
|
|
|
|
|
|
json['endTime']
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideTrackerPosition:
|
|
|
|
|
|
|
|
""" Tracker position object representation """
|
|
|
|
|
|
|
|
def __init__(self, fixtime, latitude, longitude, altitude, speed, address): # pylint: disable= R0913
|
|
|
|
|
|
|
|
self._fixtime = fixtime
|
|
|
|
|
|
|
|
self._latitude = latitude
|
|
|
|
|
|
|
|
self._longitude = longitude
|
|
|
|
|
|
|
|
self._altitude = altitude
|
|
|
|
|
|
|
|
self._speed = speed
|
|
|
|
|
|
|
|
self._address = address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def fixtime(self):
|
|
|
|
|
|
|
|
""" fixtime """
|
|
|
|
|
|
|
|
return self._fixtime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def latitude(self):
|
|
|
|
|
|
|
|
""" latitude """
|
|
|
|
|
|
|
|
return self._latitude
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def longitude(self):
|
|
|
|
|
|
|
|
""" longitude """
|
|
|
|
|
|
|
|
return self._longitude
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def altitude(self):
|
|
|
|
|
|
|
|
""" altitude """
|
|
|
|
|
|
|
|
return self._altitude
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def speed(self):
|
|
|
|
|
|
|
|
""" speed (m/s) """
|
|
|
|
|
|
|
|
return self._speed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def address(self):
|
|
|
|
|
|
|
|
""" address """
|
|
|
|
|
|
|
|
return self._address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def from_json(json):
|
|
|
|
|
|
|
|
"""return new object fromjson"""
|
|
|
|
|
|
|
|
return GeoRideTrackerPosition(
|
|
|
|
|
|
|
|
json['fixtime'],
|
|
|
|
|
|
|
|
json['latitude'],
|
|
|
|
|
|
|
|
json['longitude'],
|
|
|
|
|
|
|
|
json['altitude'],
|
|
|
|
|
|
|
|
json['speed'],
|
|
|
|
|
|
|
|
json['address']
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
""" Tracker position object representation """
|
|
|
|
""" Tracker position object representation """
|
|
|
|
def __init__(self, tracker_id, tracker_name, device_button_action, device_button_delay, # pylint: disable= R0913, R0914, R0915
|
|
|
|
def __init__(self, tracker_id, tracker_name, device_button_action, device_button_delay, # pylint: disable= R0913, R0914, R0915
|
|
|
@ -230,7 +21,8 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
internal_battery_voltage, timezone, is_second_gen, is_up_to_date,
|
|
|
|
internal_battery_voltage, timezone, is_second_gen, is_up_to_date,
|
|
|
|
subscription, version, gift_card_expires, gift_card_months, odometer_updated_at,
|
|
|
|
subscription, version, gift_card_expires, gift_card_months, odometer_updated_at,
|
|
|
|
maintenance_mode_until, battery_updated_at, is_in_eco, is_calibrated,
|
|
|
|
maintenance_mode_until, battery_updated_at, is_in_eco, is_calibrated,
|
|
|
|
is_oldsubscription, software_version, has_beacon, has_outdated_beacons, ecall_activated):
|
|
|
|
is_oldsubscription, software_version, has_beacon, has_outdated_beacons, ecall_activated,
|
|
|
|
|
|
|
|
ecall_crash_mode, assistance_theft_activated,model, business_model, has_theft_case_opened):
|
|
|
|
self._tracker_id = tracker_id
|
|
|
|
self._tracker_id = tracker_id
|
|
|
|
self._tracker_name = tracker_name
|
|
|
|
self._tracker_name = tracker_name
|
|
|
|
self._device_button_action = device_button_action
|
|
|
|
self._device_button_action = device_button_action
|
|
|
@ -288,9 +80,15 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
self._has_beacon = has_beacon
|
|
|
|
self._has_beacon = has_beacon
|
|
|
|
self._has_outdated_beacons = has_outdated_beacons
|
|
|
|
self._has_outdated_beacons = has_outdated_beacons
|
|
|
|
self._ecall_activated = ecall_activated
|
|
|
|
self._ecall_activated = ecall_activated
|
|
|
|
|
|
|
|
self._ecall_crash_mode = ecall_crash_mode
|
|
|
|
|
|
|
|
self._assistance_theft_activated = assistance_theft_activated
|
|
|
|
|
|
|
|
self._model = model
|
|
|
|
|
|
|
|
self._business_model = business_model
|
|
|
|
|
|
|
|
self._has_theft_case_opened = has_theft_case_opened
|
|
|
|
self._is_siren_on = False
|
|
|
|
self._is_siren_on = False
|
|
|
|
self._siren_last_on_date = time.time()
|
|
|
|
self._siren_last_on_date = time.time()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def tracker_id(self):
|
|
|
|
def tracker_id(self):
|
|
|
|
""" tracker_id """
|
|
|
|
""" tracker_id """
|
|
|
@ -653,9 +451,48 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
""" ecall_activated property """
|
|
|
|
""" ecall_activated property """
|
|
|
|
return self._ecall_activated
|
|
|
|
return self._ecall_activated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def version(self):
|
|
|
|
|
|
|
|
""" version property """
|
|
|
|
|
|
|
|
return self._version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def ecall_crash_mode(self):
|
|
|
|
|
|
|
|
""" eCallCrashMode property """
|
|
|
|
|
|
|
|
return self._ecall_crash_mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def _ssistance_theft_activated(self):
|
|
|
|
|
|
|
|
""" assistanceTheftActivated property """
|
|
|
|
|
|
|
|
return self._assistance_theft_activated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def model(self):
|
|
|
|
|
|
|
|
""" model property """
|
|
|
|
|
|
|
|
return self._model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def business_model(self):
|
|
|
|
|
|
|
|
""" businessModel property """
|
|
|
|
|
|
|
|
return self._business_model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def has_theft_case_opened(self):
|
|
|
|
|
|
|
|
""" hasTheftCaseOpened property """
|
|
|
|
|
|
|
|
return self._has_theft_case_opened
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def from_json(cls, json):
|
|
|
|
def from_json(cls, json):
|
|
|
|
"""return new object fromjson"""
|
|
|
|
"""return new object fromjson"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"version": 3,
|
|
|
|
|
|
|
|
"eCallCrashMode": "default",
|
|
|
|
|
|
|
|
"assistanceTheftActivated": True,
|
|
|
|
|
|
|
|
"model": "georide-3",
|
|
|
|
|
|
|
|
"businessModel": "leasing",
|
|
|
|
|
|
|
|
"hasTheftCaseOpened": False,
|
|
|
|
|
|
|
|
|
|
|
|
return GeoRideTracker(
|
|
|
|
return GeoRideTracker(
|
|
|
|
json['trackerId'], # Mandatory
|
|
|
|
json['trackerId'], # Mandatory
|
|
|
|
json['trackerName'], # Mandatory
|
|
|
|
json['trackerName'], # Mandatory
|
|
|
@ -694,14 +531,14 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
cls.json_field_protect(json,'canSendBrokenDownSignal', False),
|
|
|
|
cls.json_field_protect(json,'canSendBrokenDownSignal', False),
|
|
|
|
cls.json_field_protect(json,'canSendStolenSignal', False),
|
|
|
|
cls.json_field_protect(json,'canSendStolenSignal', False),
|
|
|
|
json['status'],# Mandatory
|
|
|
|
json['status'],# Mandatory
|
|
|
|
cls.json_field_protect(json,'subscriptionId'),
|
|
|
|
cls.json_field_protect(json,'subscriptionId', -1),
|
|
|
|
cls.json_field_protect(json,'externalBatteryVoltage', -1.0),
|
|
|
|
cls.json_field_protect(json,'externalBatteryVoltage', -1.0),
|
|
|
|
cls.json_field_protect(json,'internalBatteryVoltage', -1.0),
|
|
|
|
cls.json_field_protect(json,'internalBatteryVoltage', -1.0),
|
|
|
|
cls.json_field_protect(json,'timezone', "Europe/Paris"),
|
|
|
|
cls.json_field_protect(json,'timezone', "Europe/Paris"),
|
|
|
|
cls.json_field_protect(json,'isSecondGen', False),
|
|
|
|
cls.json_field_protect(json,'isSecondGen', False),
|
|
|
|
cls.json_field_protect(json,'isUpToDate', False),
|
|
|
|
cls.json_field_protect(json,'isUpToDate', False),
|
|
|
|
GeoRideSubscription.from_json(json['subscription']) if cls.json_field_protect(json,'subscription') is not None else None,
|
|
|
|
GeoRideSubscription.from_json(json['subscription']) if cls.json_field_protect(json,'subscription') is not None else None,
|
|
|
|
cls.json_field_protect(json,'version', -1),
|
|
|
|
cls.json_field_protect(json,'version', 1),
|
|
|
|
cls.json_field_protect(json,'giftCardExpires'),
|
|
|
|
cls.json_field_protect(json,'giftCardExpires'),
|
|
|
|
cls.json_field_protect(json,'giftCardMonths'),
|
|
|
|
cls.json_field_protect(json,'giftCardMonths'),
|
|
|
|
cls.json_field_protect(json,'odometerUpdatedAt'),
|
|
|
|
cls.json_field_protect(json,'odometerUpdatedAt'),
|
|
|
@ -710,7 +547,7 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
cls.json_field_protect(json,'isInEco', False),
|
|
|
|
cls.json_field_protect(json,'isInEco', False),
|
|
|
|
cls.json_field_protect(json,'isCalibrated', True),
|
|
|
|
cls.json_field_protect(json,'isCalibrated', True),
|
|
|
|
cls.json_field_protect(json,'isOldSubscription', True),
|
|
|
|
cls.json_field_protect(json,'isOldSubscription', True),
|
|
|
|
cls.json_field_protect(json,'softwareVersion', -1),
|
|
|
|
cls.json_field_protect(json,'softwareVersion', 1),
|
|
|
|
cls.json_field_protect(json,'hasBeacon', False),
|
|
|
|
cls.json_field_protect(json,'hasBeacon', False),
|
|
|
|
cls.json_field_protect(json,'hasOutdatedBeacons', False),
|
|
|
|
cls.json_field_protect(json,'hasOutdatedBeacons', False),
|
|
|
|
cls.json_field_protect(json,'eCallActivated', False)
|
|
|
|
cls.json_field_protect(json,'eCallActivated', False)
|
|
|
@ -774,341 +611,8 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
|
|
|
|
self._has_beacon = tracker.has_beacon
|
|
|
|
self._has_beacon = tracker.has_beacon
|
|
|
|
self._has_outdated_beacons = tracker.has_outdated_beacons
|
|
|
|
self._has_outdated_beacons = tracker.has_outdated_beacons
|
|
|
|
self._ecall_activated = tracker.ecall_activated
|
|
|
|
self._ecall_activated = tracker.ecall_activated
|
|
|
|
|
|
|
|
self._ecall_crash_mode = tracker.ecall_crash_mode
|
|
|
|
class GeoRideTrackerBeacon:
|
|
|
|
self._assistance_theft_activated = tracker.assistance_theft_activated
|
|
|
|
""" GeoRideTrackerBeacon representation """
|
|
|
|
self._model = tracker.model
|
|
|
|
def __init__(self, beacon_id, linked_tracker_id, name, created_at, updated_at,
|
|
|
|
self._business_model = tracker.business_model
|
|
|
|
mac_address, battery_level, last_battery_level_update, sleep_delay,
|
|
|
|
self._has_theft_case_opened = tracker.has_theft_case_opened
|
|
|
|
is_updated, power):
|
|
|
|
|
|
|
|
self._beacon_id = beacon_id
|
|
|
|
|
|
|
|
self._linked_tracker_id = linked_tracker_id
|
|
|
|
|
|
|
|
self._name = name
|
|
|
|
|
|
|
|
self._created_at = created_at
|
|
|
|
|
|
|
|
self._updated_at = updated_at
|
|
|
|
|
|
|
|
self._mac_address = mac_address
|
|
|
|
|
|
|
|
self._battery_level = battery_level
|
|
|
|
|
|
|
|
self._last_battery_level_update = last_battery_level_update
|
|
|
|
|
|
|
|
self._sleep_delay = sleep_delay
|
|
|
|
|
|
|
|
self._is_updated = is_updated
|
|
|
|
|
|
|
|
self._power = power
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def linked_tracker_id(self):
|
|
|
|
|
|
|
|
""" linked_tracker_id property """
|
|
|
|
|
|
|
|
return self._linked_tracker_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@linked_tracker_id.setter
|
|
|
|
|
|
|
|
def linked_tracker_id(self, linked_tracker_id):
|
|
|
|
|
|
|
|
""" linked_tracker_id setter """
|
|
|
|
|
|
|
|
self._linked_tracker_id = linked_tracker_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def beacon_id(self):
|
|
|
|
|
|
|
|
"""beacon_id property"""
|
|
|
|
|
|
|
|
return self._beacon_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def name(self):
|
|
|
|
|
|
|
|
"""name property"""
|
|
|
|
|
|
|
|
return self._name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def created_at(self):
|
|
|
|
|
|
|
|
"""created_at property"""
|
|
|
|
|
|
|
|
return self._created_at
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def updated_at(self):
|
|
|
|
|
|
|
|
"""updated_at property"""
|
|
|
|
|
|
|
|
return self._updated_at
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def mac_address(self):
|
|
|
|
|
|
|
|
"""mac_address property"""
|
|
|
|
|
|
|
|
return self._mac_address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def battery_level(self):
|
|
|
|
|
|
|
|
"""battery_level property"""
|
|
|
|
|
|
|
|
return self._battery_level
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def last_battery_level_update(self):
|
|
|
|
|
|
|
|
"""last_battery_level_update property"""
|
|
|
|
|
|
|
|
return self._last_battery_level_update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def sleep_delay(self):
|
|
|
|
|
|
|
|
"""sleep_delay property"""
|
|
|
|
|
|
|
|
return self._sleep_delay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def is_updated(self):
|
|
|
|
|
|
|
|
"""is_updated property"""
|
|
|
|
|
|
|
|
return self._is_updated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def power(self):
|
|
|
|
|
|
|
|
"""power property"""
|
|
|
|
|
|
|
|
return self._power
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def from_json(cls, json):
|
|
|
|
|
|
|
|
"""return new object from_json"""
|
|
|
|
|
|
|
|
return GeoRideTrackerBeacon(
|
|
|
|
|
|
|
|
json['id'],
|
|
|
|
|
|
|
|
json['linked_tracker_id'],
|
|
|
|
|
|
|
|
json['name'],
|
|
|
|
|
|
|
|
json['createdAt'],
|
|
|
|
|
|
|
|
json['updatedAt'],
|
|
|
|
|
|
|
|
json['macAddress'],
|
|
|
|
|
|
|
|
json['batteryLevel'],
|
|
|
|
|
|
|
|
json['lastBatteryLevelUpdate'],
|
|
|
|
|
|
|
|
json['sleepDelay'],
|
|
|
|
|
|
|
|
json['isUpdated'],
|
|
|
|
|
|
|
|
json['power'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_all_data(self, tracker_beacon):
|
|
|
|
|
|
|
|
"""update all data of the tracker beacon from a new object"""
|
|
|
|
|
|
|
|
self._name = tracker_beacon.name
|
|
|
|
|
|
|
|
self._created_at = tracker_beacon.created_at
|
|
|
|
|
|
|
|
self._updated_at = tracker_beacon.updated_at
|
|
|
|
|
|
|
|
self._mac_address = tracker_beacon.mac_address
|
|
|
|
|
|
|
|
self._battery_level = tracker_beacon.battery_level
|
|
|
|
|
|
|
|
self._last_battery_level_update = tracker_beacon.last_battery_level_update
|
|
|
|
|
|
|
|
self._sleep_delay = tracker_beacon.sleep_delay
|
|
|
|
|
|
|
|
self._is_updated = tracker_beacon.is_updated
|
|
|
|
|
|
|
|
self._power = tracker_beacon.power
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideSubscription(metaclass=JsonMgtMetaClass):
|
|
|
|
|
|
|
|
""" Account object representation """
|
|
|
|
|
|
|
|
def __init__(self, subscription_id, subscription_type, initial_date, next_payment_date,
|
|
|
|
|
|
|
|
status, paused_since, cancel_requested, price, first_name, last_name, card_information):
|
|
|
|
|
|
|
|
self._subscription_id = subscription_id
|
|
|
|
|
|
|
|
self._subscription_type = subscription_type
|
|
|
|
|
|
|
|
self._initial_date = initial_date
|
|
|
|
|
|
|
|
self._next_payment_date = next_payment_date
|
|
|
|
|
|
|
|
self._status = status
|
|
|
|
|
|
|
|
self._paused_since = paused_since
|
|
|
|
|
|
|
|
self._cancel_requested = cancel_requested
|
|
|
|
|
|
|
|
self._price = price
|
|
|
|
|
|
|
|
self._first_name = first_name
|
|
|
|
|
|
|
|
self._last_name = last_name
|
|
|
|
|
|
|
|
self._card_information = card_information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def subscription_id(self):
|
|
|
|
|
|
|
|
"""subscription_id property"""
|
|
|
|
|
|
|
|
return self._subscription_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def subscription_type(self):
|
|
|
|
|
|
|
|
"""subscription_type property"""
|
|
|
|
|
|
|
|
return self._subscription_type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def initial_date(self):
|
|
|
|
|
|
|
|
"""initial_date property"""
|
|
|
|
|
|
|
|
return self._initial_date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def next_payment_date(self):
|
|
|
|
|
|
|
|
"""next_payment_date property"""
|
|
|
|
|
|
|
|
return self._next_payment_date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def status(self):
|
|
|
|
|
|
|
|
"""status property"""
|
|
|
|
|
|
|
|
return self._status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def paused_since(self):
|
|
|
|
|
|
|
|
"""paused_since property"""
|
|
|
|
|
|
|
|
return self._paused_since
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def cancel_requested(self):
|
|
|
|
|
|
|
|
"""cancel_requested property"""
|
|
|
|
|
|
|
|
return self._cancel_requested
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def price(self):
|
|
|
|
|
|
|
|
"""price property"""
|
|
|
|
|
|
|
|
return self._price
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def first_name(self):
|
|
|
|
|
|
|
|
"""first_name property"""
|
|
|
|
|
|
|
|
return self._first_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def last_name(self):
|
|
|
|
|
|
|
|
"""last_name property"""
|
|
|
|
|
|
|
|
return self._last_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def card_information(self):
|
|
|
|
|
|
|
|
"""card_information property"""
|
|
|
|
|
|
|
|
return self._card_information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def from_json(cls, json):
|
|
|
|
|
|
|
|
"""return new object from_json"""
|
|
|
|
|
|
|
|
card_info = GeoRideSubscription_CardInfo.from_json(json['cardInformation']) if cls.json_field_protect(json, 'cardInformation', None) is not None else {}
|
|
|
|
|
|
|
|
return GeoRideSubscription(
|
|
|
|
|
|
|
|
json['id'],
|
|
|
|
|
|
|
|
json['type'],
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'initialDate'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'nextPaymentDate'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'status'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'pausedSince'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'cancelRequested'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'price'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'firstName'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'lastName'),
|
|
|
|
|
|
|
|
card_info
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideSubscription_CardInfo(metaclass=JsonMgtMetaClass):
|
|
|
|
|
|
|
|
""" Account object representation """
|
|
|
|
|
|
|
|
def __init__(self, last_digits, expiry, brand):
|
|
|
|
|
|
|
|
self._last_digits = last_digits
|
|
|
|
|
|
|
|
self._expiry = expiry
|
|
|
|
|
|
|
|
self._brand = brand
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def last_digits(self):
|
|
|
|
|
|
|
|
"""last_digits property"""
|
|
|
|
|
|
|
|
return self._last_digits
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def expiry(self):
|
|
|
|
|
|
|
|
"""expiry property"""
|
|
|
|
|
|
|
|
return self._expiry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def brand(self):
|
|
|
|
|
|
|
|
"""brand property"""
|
|
|
|
|
|
|
|
return self._brand
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def from_json(cls, json):
|
|
|
|
|
|
|
|
"""return new object from_json"""
|
|
|
|
|
|
|
|
return GeoRideSubscription_CardInfo(
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'lastDigits'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'expiry'),
|
|
|
|
|
|
|
|
cls.json_field_protect(json, 'brand')
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideAccount:
|
|
|
|
|
|
|
|
""" Account object representation """
|
|
|
|
|
|
|
|
def __init__(self, account_id, email, is_admin, auth_token):
|
|
|
|
|
|
|
|
self._account_id = account_id
|
|
|
|
|
|
|
|
self._email = email
|
|
|
|
|
|
|
|
self._is_admin = is_admin
|
|
|
|
|
|
|
|
self._auth_token = auth_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def account_id(self):
|
|
|
|
|
|
|
|
""" account_id """
|
|
|
|
|
|
|
|
return self._account_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def email(self):
|
|
|
|
|
|
|
|
""" email """
|
|
|
|
|
|
|
|
return self._email
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def is_admin(self):
|
|
|
|
|
|
|
|
""" is_admin """
|
|
|
|
|
|
|
|
return self._is_admin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def auth_token(self):
|
|
|
|
|
|
|
|
""" auth_token """
|
|
|
|
|
|
|
|
return self._auth_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@auth_token.setter
|
|
|
|
|
|
|
|
def auth_token(self, new_token):
|
|
|
|
|
|
|
|
""" change auth_token """
|
|
|
|
|
|
|
|
self._auth_token = new_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def from_json(json):
|
|
|
|
|
|
|
|
"""return new object from_json"""
|
|
|
|
|
|
|
|
return GeoRideAccount(
|
|
|
|
|
|
|
|
json['id'],
|
|
|
|
|
|
|
|
json['email'],
|
|
|
|
|
|
|
|
json['isAdmin'],
|
|
|
|
|
|
|
|
json['authToken']
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GeoRideUser: # pylint: disable= R0902
|
|
|
|
|
|
|
|
""" User object representation """
|
|
|
|
|
|
|
|
def __init__(self, user_id, email, first_name, created_at, phone_number, # pylint: disable= R0913
|
|
|
|
|
|
|
|
push_user_token, legal, date_of_birth):
|
|
|
|
|
|
|
|
self._user_id = user_id
|
|
|
|
|
|
|
|
self._email = email
|
|
|
|
|
|
|
|
self._first_name = first_name
|
|
|
|
|
|
|
|
self._created_at = created_at
|
|
|
|
|
|
|
|
self._phone_number = phone_number
|
|
|
|
|
|
|
|
self._push_user_token = push_user_token
|
|
|
|
|
|
|
|
self._legal = legal
|
|
|
|
|
|
|
|
self._date_of_birth = date_of_birth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def user_id(self):
|
|
|
|
|
|
|
|
""" user_id """
|
|
|
|
|
|
|
|
return self._user_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def email(self):
|
|
|
|
|
|
|
|
""" email """
|
|
|
|
|
|
|
|
return self._email
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def first_name(self):
|
|
|
|
|
|
|
|
""" first_name """
|
|
|
|
|
|
|
|
return self._first_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def created_at(self):
|
|
|
|
|
|
|
|
""" created_at """
|
|
|
|
|
|
|
|
return self._created_at
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def phone_number(self):
|
|
|
|
|
|
|
|
""" phone_number """
|
|
|
|
|
|
|
|
return self._phone_number
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def push_user_token(self):
|
|
|
|
|
|
|
|
""" push_user_token """
|
|
|
|
|
|
|
|
return self._push_user_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def legal(self):
|
|
|
|
|
|
|
|
""" legal """
|
|
|
|
|
|
|
|
return self._legal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def date_of_birth(self):
|
|
|
|
|
|
|
|
""" date_ofo_birth """
|
|
|
|
|
|
|
|
return self._date_of_birth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def from_json(json):
|
|
|
|
|
|
|
|
"""return new object fromjson"""
|
|
|
|
|
|
|
|
return GeoRideUser(
|
|
|
|
|
|
|
|
json['id'],
|
|
|
|
|
|
|
|
json['email'],
|
|
|
|
|
|
|
|
json['firstName'],
|
|
|
|
|
|
|
|
json['createdAt'],
|
|
|
|
|
|
|
|
json['phoneNumber'],
|
|
|
|
|
|
|
|
json['pushUserToken'],
|
|
|
|
|
|
|
|
json['legal'],
|
|
|
|
|
|
|
|
json['dateOfBirth']
|
|
|
|
|
|
|
|
)
|
|
|
|
|