3 Commits

Author SHA1 Message Date
b53fdc07f8 Shipping v0.8.3 2022-03-19 21:43:23 +01:00
9c7d2890da Add support of missing fileds on GeoRide Subscription, remove deprectaed class 2022-03-19 21:39:49 +01:00
d93bab0fcf Imporve example 2022-03-06 12:25:50 +01:00
4 changed files with 13 additions and 26 deletions

View File

@@ -28,10 +28,13 @@ def example():
def locked_locked(data): def locked_locked(data):
_LOGGER.info("Lock received") _LOGGER.info("Lock received")
def refresh_tracker():
_LOGGER.info("Refresh tracker recieved")
def connect_socket(account): def connect_socket(account):
socket = GeoRideSocket() socket = GeoRideSocket()
socket.subscribe_locked(locked_locked) socket.subscribe_locked(locked_locked)
socket.subscribe_refresh_tracker(refresh_tracker)
socket.init() socket.init()
socket.connect(account.auth_token) socket.connect(account.auth_token)
time.sleep(10) time.sleep(10)

View File

@@ -882,7 +882,7 @@ class GeoRideTrackerBeacon:
self._power = tracker_beacon.power self._power = tracker_beacon.power
class GeoRideSubscription: class GeoRideSubscription(metaclass=JsonMgtMetaClass):
""" Account object representation """ """ Account object representation """
def __init__(self, subscription_id, subscription_type, initial_date, next_payment_date, def __init__(self, subscription_id, subscription_type, initial_date, next_payment_date,
status, paused_since, cancel_requested, price, first_name, last_name, card_information): status, paused_since, cancel_requested, price, first_name, last_name, card_information):
@@ -959,14 +959,14 @@ class GeoRideSubscription:
return GeoRideSubscription( return GeoRideSubscription(
json['id'], json['id'],
json['type'], json['type'],
json['initialDate'], cls.json_field_protect(json, 'initialDate'),
json['nextPaymentDate'], cls.json_field_protect(json, 'nextPaymentDate'),
json['status'], cls.json_field_protect(json, 'status'),
json['pausedSince'], cls.json_field_protect(json, 'pausedSince'),
json['cancelRequested'], cls.json_field_protect(json, 'cancelRequested'),
json['price'], cls.json_field_protect(json, 'price'),
json['firstName'], cls.json_field_protect(json, 'firstName'),
json['lastName'], cls.json_field_protect(json, 'lastName'),
GeoRideSubscription_CardInfo.from_json(json['cardInformation']) GeoRideSubscription_CardInfo.from_json(json['cardInformation'])
) )

View File

@@ -112,19 +112,3 @@ class GeoRideSocket():
def disconnect(self): def disconnect(self):
"""disconnect from the georide socket""" """disconnect from the georide socket"""
sio.disconnect() sio.disconnect()
#TODO: remove in v0.8.0
class GeorideSocket(GeoRideSocket):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideSocket is deprecated, modify %s to use GeoRideSocket",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideSocket is deprecated, modify your code to use GeoRideSocket")

View File

@@ -19,7 +19,7 @@ CURRENT_DIR = os.path.dirname(__file__)
setup( setup(
name='georideapilib', name='georideapilib',
packages=['georideapilib'], # this must be the same as the name above packages=['georideapilib'], # this must be the same as the name above
version='0.8.2', version='0.8.3',
description='Lib to control GeoRide tracker devices with theire rest api', description='Lib to control GeoRide tracker devices with theire rest api',
author='Matthieu DUVAL', author='Matthieu DUVAL',
author_email='georideapilib@duval-dev.fr', author_email='georideapilib@duval-dev.fr',