def _json_to_obj(cls, serialized_str): json_dict = json.loads(serialized_str) rate_dict = json_dict.get("limits").get("rate") rates = Rate._dict_to_obj(rate_dict) absolute_dict = json_dict.get("limits").get("absolute") absolute = Absolute._dict_to_obj(absolute_dict) usedLimitsForAdmin = UsedLimits(rates, absolute) return usedLimitsForAdmin
def _json_to_obj(cls, serialized_str): json_dict = json.loads(serialized_str) rate_dict = json_dict.get('limits').get('rate') rates = Rate._dict_to_obj(rate_dict) absolute_dict = json_dict.get('limits').get('absolute') absolute = Absolute._dict_to_obj(absolute_dict) usedLimitsForAdmin = UsedLimits(rates, absolute) return usedLimitsForAdmin
def _xml_to_obj(cls, serialized_str): limits = ET.fromstring(serialized_str) rates_xml = limits.find("rates") rates = Rate._xml_ele_to_obj(rates_xml) absolute_xml = limits.find("absolute") absolute = Absolute._xml_ele_to_obj(absolute_xml) usedLimitsForAdmin = UsedLimits(rates, absolute) return usedLimitsForAdmin
def _xml_to_obj(cls, serialized_str): limits = ET.fromstring(serialized_str) rates_xml = limits.find('rates') rates = Rate._xml_ele_to_obj(rates_xml) absolute_xml = limits.find('absolute') absolute = Absolute._xml_ele_to_obj(absolute_xml) usedLimitsForAdmin = UsedLimits(rates, absolute) return usedLimitsForAdmin