(self, group_dict)
Feed group data from a dictionary.

        Args:
            group_dict (dict): a dictionary with the aggregation group
                information.

        Raises:
            TypeError: if the dictionary does not contain the correct
                information.
Feed group data from a dictionary.
Feed group data from a dictionary .
def from_dict(self, group_dict):
        """Feed group data from a dictionary.

        Args:
            group_dict (dict): a dictionary with the aggregation group
                information.

        Raises:
            TypeError: if the dictionary does not contain the correct
                information.
        """
        group_id = group_dict.get('id')
        if not group_id:
            raise TypeError('Group ID is missing.')
        self._resource_id = group_id
        self.resource_uri = 'sketches/{0:d}/aggregation/group/{1:d}/'.format(
            self._sketch.id, group_id)

        self._name = group_dict.get('name', '')
        self._description = group_dict.get('description', '')

        self._created_at = group_dict.get('created_at', '')
        self._updated_at = group_dict.get('updated_at', '')

        self._orientation = group_dict.get('orientation')
        if not self._orientation:
            raise TypeError('How a group is connected needs to be defined.')

        parameter_string = group_dict.get('parameters', '')
        if parameter_string:
            self._parameters = json.loads(parameter_string)

        aggs = group_dict.get('agg_ids')
        if not aggs:
            raise TypeError('Group contains no aggregations')

        if isinstance(aggs, str):
            aggs = json.loads(aggs)

        if not isinstance(aggs, (list, tuple)):
            raise TypeError('Aggregations need to be a list.')

        self._aggregations = []
        for agg_id in aggs:
            agg_obj = Aggregation(self._sketch)
            agg_obj.from_saved(agg_id)
            self._aggregations.append(agg_obj)
def from_dict ( self , group_dict ) : group_id = group_dict . get ( 'id' ) if not group_id : raise TypeError ( 'Group ID is missing.' ) self . _resource_id = group_id self . resource_uri = 'sketches/{0:d}/aggregation/group/{1:d}/' . format ( self . _sketch . id , group_id ) self . _name = group_dict . get ( 'name' , '' ) self . _description = group_dict . get ( 'description' , '' ) self . _created_at = group_dict . get ( 'created_at' , '' ) self . _updated_at = group_dict . get ( 'updated_at' , '' ) self . _orientation = group_dict . get ( 'orientation' ) if not self . _orientation : raise TypeError ( 'How a group is connected needs to be defined.' ) parameter_string = group_dict . get ( 'parameters' , '' ) if parameter_string : self . _parameters = json . loads ( parameter_string ) aggs = group_dict . get ( 'agg_ids' ) if not aggs : raise TypeError ( 'Group contains no aggregations' ) if isinstance ( aggs , str ) : aggs = json . loads ( aggs ) if not isinstance ( aggs , ( list , tuple ) ) : raise TypeError ( 'Aggregations need to be a list.' ) self . _aggregations = [ ] for agg_id in aggs : agg_obj = Aggregation ( self . _sketch ) agg_obj . from_saved ( agg_id ) self . _aggregations . append ( agg_obj )