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

22 statements  

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

1class SendAt(object): 

2 """A unix timestamp allowing you to specify when you want your 

3 email to be delivered. This may be overridden by the 

4 personalizations[x].send_at parameter. You can't schedule more 

5 than 72 hours in advance. If you have the flexibility, it's 

6 better to schedule mail for off-peak times. Most emails are 

7 scheduled and sent at the top of the hour or half hour. 

8 Scheduling email to avoid those times (for example, scheduling 

9 at 10:53) can result in lower deferral rates because it won't 

10 be going through our servers at the same times as everyone else's 

11 mail.""" 

12 def __init__(self, send_at=None, p=None): 

13 """Create a unix timestamp specifying when your email should 

14 be delivered. 

15 

16 :param send_at: Unix timestamp 

17 :type send_at: integer 

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

19 index 

20 :type name: Personalization, integer, optional 

21 """ 

22 self._send_at = None 

23 self._personalization = None 

24 

25 if send_at is not None: 

26 self.send_at = send_at 

27 if p is not None: 

28 self.personalization = p 

29 

30 @property 

31 def send_at(self): 

32 """A unix timestamp. 

33 

34 :rtype: integer 

35 """ 

36 return self._send_at 

37 

38 @send_at.setter 

39 def send_at(self, value): 

40 """A unix timestamp. 

41 

42 :param value: A unix timestamp. 

43 :type value: integer 

44 """ 

45 self._send_at = value 

46 

47 @property 

48 def personalization(self): 

49 """The Personalization object or Personalization object index 

50 

51 :rtype: Personalization, integer 

52 """ 

53 return self._personalization 

54 

55 @personalization.setter 

56 def personalization(self, value): 

57 """The Personalization object or Personalization object index 

58 

59 :param value: The Personalization object or Personalization object 

60 index 

61 :type value: Personalization, integer 

62 """ 

63 self._personalization = value 

64 

65 def __str__(self): 

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

67 

68 :rtype: integer 

69 """ 

70 return str(self.get()) 

71 

72 def get(self): 

73 """ 

74 Get a JSON-ready representation of this SendAt object. 

75 

76 :returns: The unix timestamp, ready for use in a request body. 

77 :rtype: integer 

78 """ 

79 return self.send_at