forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfooter_settings.py
94 lines (73 loc) · 2.33 KB
/
footer_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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
class FooterSettings(object):
"""The default footer that you would like included on every email."""
def __init__(self, enable=None, text=None, html=None):
"""Create a default footer.
:param enable: Whether this footer should be applied.
:type enable: boolean, optional
:param text: Text content of this footer
:type text: FooterText, optional
:param html: HTML content of this footer
:type html: FooterHtml, optional
"""
self._enable = None
self._text = None
self._html = None
if enable is not None:
self.enable = enable
if text is not None:
self.text = text
if html is not None:
self.html = html
@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.
:param value: Indicates if this setting is enabled.
:type value: boolean
"""
self._enable = value
@property
def text(self):
"""The plain text content of your footer.
:rtype: string
"""
return self._text
@text.setter
def text(self, value):
"""The plain text content of your footer.
:param value: The plain text content of your footer.
:type value: string
"""
self._text = value
@property
def html(self):
"""The HTML content of your footer.
:rtype: string
"""
return self._html
@html.setter
def html(self, value):
"""The HTML content of your footer.
:param value: The HTML content of your footer.
:type value: string
"""
self._html = value
def get(self):
"""
Get a JSON-ready representation of this FooterSettings.
:returns: This FooterSettings, ready for use in a request body.
:rtype: dict
"""
footer_settings = {}
if self.enable is not None:
footer_settings["enable"] = self.enable
if self.text is not None:
footer_settings["text"] = self.text.get()
if self.html is not None:
footer_settings["html"] = self.html.get()
return footer_settings