CloudbusTransitItem.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CloudbusTransitItem(object):
  6. def __init__(self):
  7. self._month = None
  8. self._type = None
  9. self._url = None
  10. @property
  11. def month(self):
  12. return self._month
  13. @month.setter
  14. def month(self, value):
  15. self._month = value
  16. @property
  17. def type(self):
  18. return self._type
  19. @type.setter
  20. def type(self, value):
  21. self._type = value
  22. @property
  23. def url(self):
  24. return self._url
  25. @url.setter
  26. def url(self, value):
  27. self._url = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.month:
  31. if hasattr(self.month, 'to_alipay_dict'):
  32. params['month'] = self.month.to_alipay_dict()
  33. else:
  34. params['month'] = self.month
  35. if self.type:
  36. if hasattr(self.type, 'to_alipay_dict'):
  37. params['type'] = self.type.to_alipay_dict()
  38. else:
  39. params['type'] = self.type
  40. if self.url:
  41. if hasattr(self.url, 'to_alipay_dict'):
  42. params['url'] = self.url.to_alipay_dict()
  43. else:
  44. params['url'] = self.url
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = CloudbusTransitItem()
  51. if 'month' in d:
  52. o.month = d['month']
  53. if 'type' in d:
  54. o.type = d['type']
  55. if 'url' in d:
  56. o.url = d['url']
  57. return o