AlipayMarketingIbsInfo.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class AlipayMarketingIbsInfo(object):
  6. def __init__(self):
  7. self._accuracy = None
  8. self._altitude = None
  9. self._latitude = None
  10. self._longitude = None
  11. self._time = None
  12. @property
  13. def accuracy(self):
  14. return self._accuracy
  15. @accuracy.setter
  16. def accuracy(self, value):
  17. self._accuracy = value
  18. @property
  19. def altitude(self):
  20. return self._altitude
  21. @altitude.setter
  22. def altitude(self, value):
  23. self._altitude = value
  24. @property
  25. def latitude(self):
  26. return self._latitude
  27. @latitude.setter
  28. def latitude(self, value):
  29. self._latitude = value
  30. @property
  31. def longitude(self):
  32. return self._longitude
  33. @longitude.setter
  34. def longitude(self, value):
  35. self._longitude = value
  36. @property
  37. def time(self):
  38. return self._time
  39. @time.setter
  40. def time(self, value):
  41. self._time = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.accuracy:
  45. if hasattr(self.accuracy, 'to_alipay_dict'):
  46. params['accuracy'] = self.accuracy.to_alipay_dict()
  47. else:
  48. params['accuracy'] = self.accuracy
  49. if self.altitude:
  50. if hasattr(self.altitude, 'to_alipay_dict'):
  51. params['altitude'] = self.altitude.to_alipay_dict()
  52. else:
  53. params['altitude'] = self.altitude
  54. if self.latitude:
  55. if hasattr(self.latitude, 'to_alipay_dict'):
  56. params['latitude'] = self.latitude.to_alipay_dict()
  57. else:
  58. params['latitude'] = self.latitude
  59. if self.longitude:
  60. if hasattr(self.longitude, 'to_alipay_dict'):
  61. params['longitude'] = self.longitude.to_alipay_dict()
  62. else:
  63. params['longitude'] = self.longitude
  64. if self.time:
  65. if hasattr(self.time, 'to_alipay_dict'):
  66. params['time'] = self.time.to_alipay_dict()
  67. else:
  68. params['time'] = self.time
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = AlipayMarketingIbsInfo()
  75. if 'accuracy' in d:
  76. o.accuracy = d['accuracy']
  77. if 'altitude' in d:
  78. o.altitude = d['altitude']
  79. if 'latitude' in d:
  80. o.latitude = d['latitude']
  81. if 'longitude' in d:
  82. o.longitude = d['longitude']
  83. if 'time' in d:
  84. o.time = d['time']
  85. return o