Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sendgrid/helpers/mail/click_tracking.py: 35%

27 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1class ClickTracking(object): 

2 """Allows you to track whether a recipient clicked a link in your email.""" 

3 

4 def __init__(self, enable=None, enable_text=None): 

5 """Create a ClickTracking to track clicked links in your email. 

6 

7 :param enable: Whether click tracking is enabled 

8 :type enable: boolean, optional 

9 :param enable_text: If click tracking is on in your email's text/plain. 

10 :type enable_text: boolean, optional 

11 """ 

12 self._enable = None 

13 self._enable_text = None 

14 

15 if enable is not None: 

16 self.enable = enable 

17 

18 if enable_text is not None: 

19 self.enable_text = enable_text 

20 

21 @property 

22 def enable(self): 

23 """Indicates if this setting is enabled. 

24 

25 :rtype: boolean 

26 """ 

27 return self._enable 

28 

29 @enable.setter 

30 def enable(self, value): 

31 """Indicates if this setting is enabled. 

32 

33 :param value: Indicates if this setting is enabled. 

34 :type value: boolean 

35 """ 

36 self._enable = value 

37 

38 @property 

39 def enable_text(self): 

40 """Indicates if this setting should be included in the text/plain 

41 portion of your email. 

42 

43 :rtype: boolean 

44 """ 

45 return self._enable_text 

46 

47 @enable_text.setter 

48 def enable_text(self, value): 

49 """Indicates if this setting should be included in the text/plain 

50 portion of your email. 

51 

52 :param value: Indicates if this setting should be included in the 

53 text/plain portion of your email. 

54 :type value: boolean 

55 """ 

56 self._enable_text = value 

57 

58 def get(self): 

59 """ 

60 Get a JSON-ready representation of this ClickTracking. 

61 

62 :returns: This ClickTracking, ready for use in a request body. 

63 :rtype: dict 

64 """ 

65 click_tracking = {} 

66 if self.enable is not None: 

67 click_tracking["enable"] = self.enable 

68 

69 if self.enable_text is not None: 

70 click_tracking["enable_text"] = self.enable_text 

71 return click_tracking