Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sendgrid/helpers/mail/subscription_tracking.py: 31%
49 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1class SubscriptionTracking(object):
2 """Allows you to insert a subscription management link at the bottom of the
3 text and html bodies of your email. If you would like to specify the
4 location of the link within your email, you may use the substitution_tag.
5 """
7 def __init__(
8 self, enable=None, text=None, html=None, substitution_tag=None):
9 """Create a SubscriptionTracking to customize subscription management.
11 :param enable: Whether this setting is enabled.
12 :type enable: boolean, optional
13 :param text: Text to be appended to the email with the link as "<% %>".
14 :type text: SubscriptionText, optional
15 :param html: HTML to be appended to the email with the link as "<% %>".
16 :type html: SubscriptionHtml, optional
17 :param substitution_tag: Tag replaced with URL. Overrides text, html
18 params.
19 :type substitution_tag: SubscriptionSubstitutionTag, optional
20 """
21 self._enable = None
22 self._text = None
23 self._html = None
24 self._substitution_tag = None
26 if enable is not None:
27 self.enable = enable
28 if text is not None:
29 self.text = text
30 if html is not None:
31 self.html = html
32 if substitution_tag is not None:
33 self.substitution_tag = substitution_tag
35 @property
36 def enable(self):
37 """Indicates if this setting is enabled.
39 :rtype: boolean
40 """
41 return self._enable
43 @enable.setter
44 def enable(self, value):
45 """Indicates if this setting is enabled.
47 :param value: Indicates if this setting is enabled.
48 :type value: boolean
49 """
50 self._enable = value
52 @property
53 def text(self):
54 """Text to be appended to the email, with the subscription tracking
55 link. You may control where the link is by using the tag <% %>
57 :rtype: string
58 """
59 return self._text
61 @text.setter
62 def text(self, value):
63 """Text to be appended to the email, with the subscription tracking
64 link. You may control where the link is by using the tag <% %>
66 :param value: Text to be appended to the email, with the subscription
67 tracking link. You may control where the link is by
68 using the tag <% %>
69 :type value: string
70 """
71 self._text = value
73 @property
74 def html(self):
75 """HTML to be appended to the email, with the subscription tracking
76 link. You may control where the link is by using the tag <% %>
78 :rtype: string
79 """
80 return self._html
82 @html.setter
83 def html(self, value):
84 """HTML to be appended to the email, with the subscription tracking
85 link. You may control where the link is by using the tag <% %>
87 :param value: HTML to be appended to the email, with the subscription
88 tracking link. You may control where the link is by
89 using the tag <% %>
90 :type value: string
91 """
92 self._html = value
94 @property
95 def substitution_tag(self):
96 """"A tag that will be replaced with the unsubscribe URL. for example:
97 [unsubscribe_url]. If this parameter is used, it will override both the
98 `text` and `html` parameters. The URL of the link will be placed at the
99 substitution tag's location, with no additional formatting.
101 :rtype: string
102 """
103 return self._substitution_tag
105 @substitution_tag.setter
106 def substitution_tag(self, value):
107 """"A tag that will be replaced with the unsubscribe URL. for example:
108 [unsubscribe_url]. If this parameter is used, it will override both the
109 `text` and `html` parameters. The URL of the link will be placed at the
110 substitution tag's location, with no additional formatting.
112 :param value: A tag that will be replaced with the unsubscribe URL.
113 For example: [unsubscribe_url]. If this parameter is
114 used, it will override both the `text` and `html`
115 parameters. The URL of the link will be placed at the
116 substitution tag's location, with no additional
117 formatting.
118 :type value: string
119 """
120 self._substitution_tag = value
122 def get(self):
123 """
124 Get a JSON-ready representation of this SubscriptionTracking.
126 :returns: This SubscriptionTracking, ready for use in a request body.
127 :rtype: dict
128 """
129 subscription_tracking = {}
130 if self.enable is not None:
131 subscription_tracking["enable"] = self.enable
133 if self.text is not None:
134 subscription_tracking["text"] = self.text.get()
136 if self.html is not None:
137 subscription_tracking["html"] = self.html.get()
139 if self.substitution_tag is not None:
140 subscription_tracking["substitution_tag"] = \
141 self.substitution_tag.get()
142 return subscription_tracking