Source code for q2_cores.XP2.queries.demographic_info_query

import logging
from typing import Optional
from lxml.builder import E

from .message_maker import MessageMaker
from .mock_responses import mock_demographic_response


[docs] class DemographicInfoQuery(MessageMaker): """Builds the xml payload for the demographic call for the XP2 core.""" def __init__( self, logger: logging.Logger, customer_id: str, class_name: Optional[str] = None, namespace: Optional[str] = None, ): self.customer_id = customer_id self._method_name = "IndividualDetails" super().__init__(logger, class_name, namespace)
[docs] def build(self): xml = E.IndividualDetailRequest( E.IndividualId(self.customer_id, xmlns=self._namespace) ) request = [xml] return self.make_message(self._method_name, request)
[docs] def mock_response(self): return mock_demographic_response()