Mixins¶
- class veritranspay.mixins.RequestEntity[source]¶
Bases: veritranspay.mixins.ValidatableMixin, veritranspay.mixins.SerializableMixin
Provides no functionality, other than incorporating SerializableMixin and ValiditableMixin in a single base class.
- class veritranspay.mixins.SerializableMixin[source]¶
Bases: object
An instance that can return a dictionary representation of it’s properties by calling a serialize() method.
- class veritranspay.mixins.ValidatableMixin[source]¶
Bases: object
Provides a mechanism for validating the attributes of an object instance. Expects a dictionary named _validators to be provided with keys that represent the names of attributes to be validated, mapped to an instance of a class in the module veritranspay.validators.
- validate_all()[source]¶
Iterates over all the validators in this instances _validators dictionary, and validates a matching attribute on this object with a validator listed in the _validators dictionary.
- validate_attr(name, value, validator)[source]¶
Tries to validate the provided value with a given validator. If validation fails, a ValidationError will be raised indicating the name of the property the failed, along with the error message.
Parameters: - name (str) – Name of the attribute being validated. This is only used for the error message when validation fails.
- value – The value that will actually be validated.
- validator (Subclass of veritranspay.validators.ValidatorBase) – The appropriate validator instance that value will be checked with.
Raises: