12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import json
- from alipay.aop.api.constant.ParamConstants import *
- class LocationInfo(object):
- def __init__(self):
- self._latitude = None
- self._longitude = None
- self._region_code = None
- @property
- def latitude(self):
- return self._latitude
- @latitude.setter
- def latitude(self, value):
- self._latitude = value
- @property
- def longitude(self):
- return self._longitude
- @longitude.setter
- def longitude(self, value):
- self._longitude = value
- @property
- def region_code(self):
- return self._region_code
- @region_code.setter
- def region_code(self, value):
- self._region_code = value
- def to_alipay_dict(self):
- params = dict()
- if self.latitude:
- if hasattr(self.latitude, 'to_alipay_dict'):
- params['latitude'] = self.latitude.to_alipay_dict()
- else:
- params['latitude'] = self.latitude
- if self.longitude:
- if hasattr(self.longitude, 'to_alipay_dict'):
- params['longitude'] = self.longitude.to_alipay_dict()
- else:
- params['longitude'] = self.longitude
- if self.region_code:
- if hasattr(self.region_code, 'to_alipay_dict'):
- params['region_code'] = self.region_code.to_alipay_dict()
- else:
- params['region_code'] = self.region_code
- return params
- @staticmethod
- def from_alipay_dict(d):
- if not d:
- return None
- o = LocationInfo()
- if 'latitude' in d:
- o.latitude = d['latitude']
- if 'longitude' in d:
- o.longitude = d['longitude']
- if 'region_code' in d:
- o.region_code = d['region_code']
- return o
|