From b28d65fe1275ce8de1a2b4469392323d5f0b084d Mon Sep 17 00:00:00 2001 From: Lucidiot Date: Sun, 3 Feb 2019 15:34:25 +0100 Subject: [PATCH] Add recipient info and features list to Delivery --- urbantz/delivery.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/urbantz/delivery.py b/urbantz/delivery.py index e548805..953236a 100644 --- a/urbantz/delivery.py +++ b/urbantz/delivery.py @@ -1,5 +1,6 @@ from datetime import datetime from urbantz.base import JSONSerializable, Coordinates +from urbantz.utils import DictObject from urbantz.exceptions import APIError import requests @@ -51,6 +52,25 @@ class Delivery(JSONSerializable): :type: urbantz.base.Coordinates """ + self.recipient = None + """ + Informations about the recipient (name, language, phone number, etc.) + Does not contain the destination location information. + + :type: urbantz.utils.DictObject + """ + + self.features = None + """ + Dictionary of booleans indicating which features of the UrbanTZ + tracking software are enabled on this delivery. + For example, ``consumerModifyInstructions`` will indicate whether + the client is allowed to update the delivery instructions after the + driver departs for its round. + + :type: urbantz.utils.DictObject + """ + def __repr__(self): return '{}({})'.format( self.__class__.__name__, repr(self.tracking_code)) @@ -104,6 +124,8 @@ class Delivery(JSONSerializable): self.position = Coordinates.fromJSON(self.payload['position']) self.destination = Coordinates.fromJSON( self.payload['location']['location']['geometry']) + self.recipient = DictObject(self.payload['contact']) + self.features = DictObject(self.payload['features']) @classmethod def fromJSON(cls, payload):