ExtensionArea.py 2.4 KB

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