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

34 statements  

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

1class CustomArg(object): 

2 """Values that will be carried along with the email and its activity data. 

3 

4 Substitutions will not be made on custom arguments, so any string entered 

5 into this parameter will be assumed to be the custom argument that you 

6 would like to be used. Top-level CustomArgs may be overridden by ones in a 

7 Personalization. May not exceed 10,000 bytes. 

8 """ 

9 

10 def __init__(self, key=None, value=None, p=None): 

11 """Create a CustomArg with the given key and value. 

12 

13 :param key: Key for this CustomArg 

14 :type key: string, optional 

15 :param value: Value of this CustomArg 

16 :type value: string, optional 

17 :param p: p is the Personalization object or Personalization 

18 object index 

19 :type p: Personalization, integer, optional 

20 """ 

21 self._key = None 

22 self._value = None 

23 self._personalization = None 

24 

25 if key is not None: 

26 self.key = key 

27 if value is not None: 

28 self.value = value 

29 if p is not None: 

30 self.personalization = p 

31 

32 @property 

33 def key(self): 

34 """Key for this CustomArg. 

35 

36 :rtype: string 

37 """ 

38 return self._key 

39 

40 @key.setter 

41 def key(self, value): 

42 """Key for this CustomArg. 

43 

44 :param value: Key for this CustomArg. 

45 :type value: string 

46 """ 

47 self._key = value 

48 

49 @property 

50 def value(self): 

51 """Value of this CustomArg. 

52 

53 :rtype: string 

54 """ 

55 return self._value 

56 

57 @value.setter 

58 def value(self, value): 

59 """Value of this CustomArg. 

60 

61 :param value: Value of this CustomArg. 

62 :type value: string 

63 """ 

64 self._value = value 

65 

66 @property 

67 def personalization(self): 

68 """The Personalization object or Personalization object index 

69 

70 :rtype: Personalization, integer 

71 """ 

72 return self._personalization 

73 

74 @personalization.setter 

75 def personalization(self, value): 

76 """The Personalization object or Personalization object index 

77 

78 :param value: The Personalization object or Personalization object 

79 index 

80 :type value: Personalization, integer 

81 """ 

82 self._personalization = value 

83 

84 def get(self): 

85 """ 

86 Get a JSON-ready representation of this CustomArg. 

87 

88 :returns: This CustomArg, ready for use in a request body. 

89 :rtype: dict 

90 """ 

91 custom_arg = {} 

92 if self.key is not None and self.value is not None: 

93 custom_arg[self.key] = self.value 

94 return custom_arg