Skip to content

Commit 3bb97f6

Browse files
echarrodemmas-yoti
authored andcommitted
SDK-993: Add docstrings to attribute properties
1 parent c4c6ce1 commit 3bb97f6

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

yoti_python_sdk/profile.py

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,104 @@ def __init__(self, profile_attributes):
4444

4545
@property
4646
def date_of_birth(self):
47+
"""date_of_birth represents the user's date of birth as a string.
48+
Will be changed to return a datetime in v3.0.0.
49+
Will be None if not provided by Yoti.
50+
:return: Attribute(str)
51+
"""
4752
return self.get_attribute(config.ATTRIBUTE_DATE_OF_BIRTH)
4853

4954
@property
5055
def family_name(self):
56+
"""family_name represents the user's family name. This will be None if not provided by Yoti.
57+
:return: Attribute(str)
58+
"""
5159
return self.get_attribute(config.ATTRIBUTE_FAMILY_NAME)
5260

61+
@property
62+
def given_names(self):
63+
"""given_names represents the user's given names. This will be None if not provided by Yoti.
64+
:return: Attribute(str)
65+
"""
66+
return self.get_attribute(config.ATTRIBUTE_GIVEN_NAMES)
67+
5368
@property
5469
def full_name(self):
70+
"""full_name represents the user's full name.
71+
If family_name and given_names are present, the value will be equal to the string 'given_names + " " + family_name'.
72+
Will be None if not provided by Yoti.
73+
:return: Attribute(str)
74+
"""
5575
return self.get_attribute(config.ATTRIBUTE_FULL_NAME)
5676

5777
@property
5878
def gender(self):
79+
"""gender corresponds to the gender in the registered document.
80+
The value will be one of the strings "MALE", "FEMALE", "TRANSGENDER" or "OTHER".
81+
Will be None if not provided by Yoti.
82+
:return: Attribute(str)
83+
"""
5984
return self.get_attribute(config.ATTRIBUTE_GENDER)
6085

61-
@property
62-
def given_names(self):
63-
return self.get_attribute(config.ATTRIBUTE_GIVEN_NAMES)
64-
6586
@property
6687
def nationality(self):
88+
"""nationality corresponds to the nationality in the passport.
89+
The value is an ISO-3166-1 alpha-3 code with ICAO9303 (passport) extensions.
90+
Will be None if not provided by Yoti.
91+
:return: Attribute(str)
92+
"""
6793
return self.get_attribute(config.ATTRIBUTE_NATIONALITY)
6894

6995
@property
7096
def email_address(self):
97+
"""email_address represents the user's email address. This will be None if not provided by Yoti.
98+
:return: Attribute(str)
99+
"""
71100
return self.get_attribute(config.ATTRIBUTE_EMAIL_ADDRESS)
72101

73102
@property
74103
def phone_number(self):
104+
"""phone_number represents the user's mobile phone number. This will be None if not provided by Yoti.
105+
:return: Attribute(str)
106+
"""
75107
return self.get_attribute(config.ATTRIBUTE_PHONE_NUMBER)
76108

77109
@property
78110
def postal_address(self):
111+
"""postal_address represents the user's address. This will be None if not provided by Yoti.
112+
:return: Attribute(str)
113+
"""
79114
return self.get_attribute(config.ATTRIBUTE_POSTAL_ADDRESS)
80115

81116
@property
82117
def selfie(self):
118+
"""selfie is a photograph of the user. Will be None if not provided by Yoti.
119+
:return: Attribute(image)
120+
"""
83121
return self.get_attribute(config.ATTRIBUTE_SELFIE)
84122

85123
@property
86124
def structured_postal_address(self):
125+
"""structured_postal_address represents the user's address represented as an OrderedDict.
126+
This will be None if not provided by Yoti.
127+
:return: Attribute(OrderedDict)
128+
"""
87129
return self.get_attribute(config.ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS)
88130

89131
@property
90132
def document_images(self):
133+
"""document_images returns a tuple of document images cropped from the image in the capture page.
134+
There can be multiple images as per the number of regions in the capture in this attribute.
135+
Will be None if not provided by Yoti.
136+
:return: Attribute(tuple(image))
137+
"""
91138
return self.get_attribute(config.ATTRIBUTE_DOCUMENT_IMAGES)
92139

93140
def get_attribute(self, attribute_name):
141+
"""retrieves an attribute based on its name
142+
:param attribute_name:
143+
:return: Attribute
144+
"""
94145
if attribute_name in self.attributes:
95146
return self.attributes.get(attribute_name)
96147
else:

0 commit comments

Comments
 (0)