def de_json(cls, data, bot): if not data: return cls() data = super(OrderInfo, cls).de_json(data, bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data, bot): if not data: return cls() data = super(OrderInfo, cls).de_json(data, bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data, bot): if not data: return None data = super(ShippingQuery, cls).de_json(data, bot) data['from_user'] = User.de_json(data.pop('from'), bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data, bot): if not data: return None data = super(ShippingQuery, cls).de_json(data, bot) data['from_user'] = User.de_json(data.pop('from'), bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data: Optional[JSONDict], bot: 'Bot') -> Optional['ShippingQuery']: data = cls.parse_data(data) if not data: return None data['from_user'] = User.de_json(data.pop('from'), bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(bot=bot, **data)
def de_json(cls, data: Optional[JSONDict], bot: 'Bot') -> Optional['OrderInfo']: """See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return cls() data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data: Optional[JSONDict], bot: 'Bot') -> Optional['OrderInfo']: data = cls.parse_data(data) if not data: return cls() data['shipping_address'] = ShippingAddress.de_json( data.get('shipping_address'), bot) return cls(**data)
def de_json(cls, data: Optional[JSONDict], bot: 'Bot') -> Optional['ShippingQuery']: """See :meth:`telegram.TelegramObject.de_json`.""" data = cls._parse_data(data) if not data: return None data['from_user'] = User.de_json(data.pop('from'), bot) data['shipping_address'] = ShippingAddress.de_json( data.get('shipping_address'), bot) return cls(bot=bot, **data)
def test_de_json(self, bot): json_dict = { 'country_code': self.country_code, 'state': self.state, 'city': self.city, 'street_line1': self.street_line1, 'street_line2': self.street_line2, 'post_code': self.post_code } shipping_address = ShippingAddress.de_json(json_dict, bot) assert shipping_address.country_code == self.country_code assert shipping_address.state == self.state assert shipping_address.city == self.city assert shipping_address.street_line1 == self.street_line1 assert shipping_address.street_line2 == self.street_line2 assert shipping_address.post_code == self.post_code
def test_de_json(self, bot): json_dict = { "country_code": self.country_code, "state": self.state, "city": self.city, "street_line1": self.street_line1, "street_line2": self.street_line2, "post_code": self.post_code, } shipping_address = ShippingAddress.de_json(json_dict, bot) assert shipping_address.country_code == self.country_code assert shipping_address.state == self.state assert shipping_address.city == self.city assert shipping_address.street_line1 == self.street_line1 assert shipping_address.street_line2 == self.street_line2 assert shipping_address.post_code == self.post_code
def de_json(data, bot): """ Args: data (dict): bot (telegram.Bot): Returns: telegram.OrderInfo: """ if not data: return OrderInfo() data = super(OrderInfo, OrderInfo).de_json(data, bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return OrderInfo(**data)
def de_json(data, bot): """ Args: data (dict): bot (telegram.Bot): Returns: telegram.OrderInfo: """ if not data: return OrderInfo() data = super(OrderInfo, OrderInfo).de_json(data, bot) data['shipping_address'] = ShippingAddress.de_json( data.get('shipping_address'), bot) return OrderInfo(**data)
def de_json(data, bot): """ Args: data (dict): bot (telegram.Bot): Returns: telegram.ShippingQuery: """ if not data: return None data = super(ShippingQuery, ShippingQuery).de_json(data, bot) data['from_user'] = User.de_json(data.pop('from'), bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) return ShippingQuery(**data)