def __init__(self, json_data): """Init a new ImmutableData object from a dictionary or JSON string. Args: json_data(dict, basestring): Input JSON string or dictionary. Raises: TypeError: If the input object is not a dictionary or string. """ super(ImmutableData, self).__init__() self._json_data = json_dict(json_data)
def __init__(self, json_data): """Init a new SimpleDataModel object from a dictionary or JSON string. Args: json_data(dict, basestring): Input JSON string or dictionary. Raises: TypeError: If the input object is not a dictionary or string. """ super(SimpleDataModel, self).__init__() for attribute, value in json_dict(json_data).items(): setattr(self, attribute, value)
def dict_data_factory(model, json_data): """Factory function for creating SimpleDataModel objects. Args: model(basestring): The data model to use when creating the data object (message, room, membership, etc.). json_data(basestring, dict): The JSON string or dictionary data with which to initialize the object. Returns: OrderedDict: An ordered dictionary with the contents of the Webex Teams JSON object. Raises: TypeError: If the json_data parameter is not a JSON string or dictionary. """ return json_dict(json_data)