class PostHog::FieldParser
def parse_for_group_identify(fields)
def parse_for_group_identify(fields) properties = fields[:properties] || {} group_type = fields[:group_type] group_key = fields[:group_key] check_presence!(group_type, 'group type') check_presence!(group_key, 'group_key') check_is_hash!(properties, 'properties') fields[:distinct_id] ||= "$#{group_type}_#{group_key}" common = parse_common_fields(fields) isoify_dates! properties common.merge( { event: '$groupidentify', properties: { '$group_type': group_type, '$group_key': group_key, '$group_set': properties.merge(common[:properties] || {}) } } ) end