forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbcc_settings.py
72 lines (56 loc) · 1.88 KB
/
bcc_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class BccSettings(object):
"""Settings object for automatic BCC.
This allows you to have a blind carbon copy automatically sent to the
specified email address for every email that is sent.
"""
def __init__(self, enable=None, email=None):
"""Create a BCCSettings.
:param enable: Whether this BCCSettings is applied to sent emails.
:type enable: boolean, optional
:param email: Who should be BCCed.
:type email: BccSettingEmail, optional
"""
self._enable = None
self._email = None
if enable is not None:
self.enable = enable
if email is not None:
self.email = email
@property
def enable(self):
"""Indicates if this setting is enabled.
:rtype: boolean
"""
return self._enable
@enable.setter
def enable(self, value):
"""Indicates if this setting is enabled.
:type param: Indicates if this setting is enabled.
:type value: boolean
"""
self._enable = value
@property
def email(self):
"""The email address that you would like to receive the BCC.
:rtype: string
"""
return self._email
@email.setter
def email(self, value):
"""The email address that you would like to receive the BCC.
:param value: The email address that you would like to receive the BCC.
:type value: string
"""
self._email = value
def get(self):
"""
Get a JSON-ready representation of this BCCSettings.
:returns: This BCCSettings, ready for use in a request body.
:rtype: dict
"""
bcc_settings = {}
if self.enable is not None:
bcc_settings["enable"] = self.enable
if self.email is not None:
bcc_settings["email"] = self.email.get()
return bcc_settings