diff --git a/cuenca/resources/questionnaires.py b/cuenca/resources/questionnaires.py new file mode 100644 index 00000000..bbcb5b71 --- /dev/null +++ b/cuenca/resources/questionnaires.py @@ -0,0 +1,40 @@ +import datetime as dt +from typing import ClassVar, cast + +from cuenca_validations.types import QuestionnaireRequest + +from ..http import Session, session as global_session +from .base import Creatable, Retrievable + + +class Questionnaires(Creatable, Retrievable): + _resource: ClassVar = 'questionnaires' + + created_at: dt.datetime + + class Config: + schema_extra = { + 'example': { + 'user_id': 'US234i23jh23h4h23', + 'token': '3223j23ij23ij3', + 'alert_id': 'ALewifjwiejf', + } + } + + @classmethod + def create( + cls, + user_id: str, + token: str, + alert_id: str, + *, + session: Session = global_session, + ) -> 'Questionnaires': + req = QuestionnaireRequest( + user_id=user_id, + token=token, + alert_id=alert_id, + ) + return cast( + 'Questionnaires', cls._create(session=session, **req.dict()) + ) diff --git a/cuenca/version.py b/cuenca/version.py index 7f440002..5d3eb7a0 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '0.15.9' +__version__ = '0.15.11.dev0' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/requirements.txt b/requirements.txt index 58ee9fc9..0c7d5659 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests==2.27.1 -cuenca-validations==0.11.19 +cuenca-validations==0.11.23.dev0 dataclasses>=0.7;python_version<"3.7"