forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request googleapis#26 from tuomas56/master
Add email address string support to setRecipients
- Loading branch information
Showing
1 changed file
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,22 +157,27 @@ def setRecipients(self,val): | |
val: the one argument this method takes can be very flexible. you can send: | ||
a dictionary: this must to be a dictionary formated as such: | ||
{"EmailAddress":{"Address":"[email protected]"}} | ||
with other options such ass "Name" with address. but at minimum it must have this. | ||
a list: this must to be a list of libraries formatted the way specified above, | ||
or it can be a list of dictionary objects of type Contact. The method will sort | ||
out the libraries from the contacts. | ||
with other options such ass "Name" with address. but at minimum | ||
it must have this. | ||
a list: this must to be a list of libraries formatted the way | ||
specified above, or it can be a list of dictionary objects of | ||
type Contact or it can be an email address as string. The | ||
method will sort out the libraries from the contacts. | ||
a string: this is if you just want to throw an email address. | ||
a contact: type Contact from this dictionary. | ||
a group: type Group, which is a list of contacts. | ||
For each of these argument types the appropriate action will be taken to fit them to the | ||
needs of the library. | ||
For each of these argument types the appropriate action will be taken | ||
to fit them to the needs of the library. | ||
''' | ||
self.json['ToRecipients'] = [] | ||
if isinstance(val,list): | ||
for con in val: | ||
if isinstance(con,Contact): | ||
self.addRecipient(con) | ||
else: | ||
elif isinstance(con, str): | ||
if '@' in con: | ||
self.addRecipient(con) | ||
elif isinstance(con, dict): | ||
self.json['ToRecipients'].append(con) | ||
elif isinstance(val,dict): | ||
self.json['ToRecipients'] = [val] | ||
|