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

22 statements  

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

1class DynamicTemplateData(object): 

2 """To send a dynamic template, specify the template ID with the 

3 template_id parameter. 

4 """ 

5 

6 def __init__(self, dynamic_template_data=None, p=0): 

7 """Data for a transactional template. 

8 Should be JSON-serializable structure. 

9 

10 :param dynamic_template_data: Data for a transactional template. 

11 :type dynamic_template_data: A JSON-serializable structure 

12 :param name: p is the Personalization object or Personalization object 

13 index 

14 :type name: Personalization, integer, optional 

15 """ 

16 self._dynamic_template_data = None 

17 self._personalization = None 

18 

19 if dynamic_template_data is not None: 19 ↛ 21line 19 didn't jump to line 21, because the condition on line 19 was never false

20 self.dynamic_template_data = dynamic_template_data 

21 if p is not None: 21 ↛ exitline 21 didn't return from function '__init__', because the condition on line 21 was never false

22 self.personalization = p 

23 

24 @property 

25 def dynamic_template_data(self): 

26 """Data for a transactional template. 

27 

28 :rtype: A JSON-serializable structure 

29 """ 

30 return self._dynamic_template_data 

31 

32 @dynamic_template_data.setter 

33 def dynamic_template_data(self, value): 

34 """Data for a transactional template. 

35 

36 :param value: Data for a transactional template. 

37 :type value: A JSON-serializable structure 

38 """ 

39 self._dynamic_template_data = value 

40 

41 @property 

42 def personalization(self): 

43 """The Personalization object or Personalization object index 

44 

45 :rtype: Personalization, integer 

46 """ 

47 return self._personalization 

48 

49 @personalization.setter 

50 def personalization(self, value): 

51 """The Personalization object or Personalization object index 

52 

53 :param value: The Personalization object or Personalization object 

54 index 

55 :type value: Personalization, integer 

56 """ 

57 self._personalization = value 

58 

59 def __str__(self): 

60 """Get a JSON representation of this object. 

61 

62 :rtype: A JSON-serializable structure 

63 """ 

64 return str(self.get()) 

65 

66 def get(self): 

67 """ 

68 Get a JSON-ready representation of this DynamicTemplateData object. 

69 

70 :returns: Data for a transactional template. 

71 :rtype: A JSON-serializable structure. 

72 """ 

73 return self.dynamic_template_data