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
« 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.
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 """
10 def __init__(self, key=None, value=None, p=None):
11 """Create a CustomArg with the given key and value.
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
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
32 @property
33 def key(self):
34 """Key for this CustomArg.
36 :rtype: string
37 """
38 return self._key
40 @key.setter
41 def key(self, value):
42 """Key for this CustomArg.
44 :param value: Key for this CustomArg.
45 :type value: string
46 """
47 self._key = value
49 @property
50 def value(self):
51 """Value of this CustomArg.
53 :rtype: string
54 """
55 return self._value
57 @value.setter
58 def value(self, value):
59 """Value of this CustomArg.
61 :param value: Value of this CustomArg.
62 :type value: string
63 """
64 self._value = value
66 @property
67 def personalization(self):
68 """The Personalization object or Personalization object index
70 :rtype: Personalization, integer
71 """
72 return self._personalization
74 @personalization.setter
75 def personalization(self, value):
76 """The Personalization object or Personalization object index
78 :param value: The Personalization object or Personalization object
79 index
80 :type value: Personalization, integer
81 """
82 self._personalization = value
84 def get(self):
85 """
86 Get a JSON-ready representation of this CustomArg.
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