-
Notifications
You must be signed in to change notification settings - Fork 322
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 #300 from teamanvyl/dynamic-template-data
Support for dynamic template data.
- Loading branch information
Showing
5 changed files
with
46 additions
and
6 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2014-2017 SendGrid, Inc. | ||
Copyright (c) 2014-2018 SendGrid, Inc. | ||
|
||
MIT License | ||
|
||
|
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 |
---|---|---|
|
@@ -125,5 +125,23 @@ def kitchen_sink | |
puts response.headers | ||
end | ||
|
||
def dynamic_template_data_hello_world | ||
mail = Mail.new | ||
mail.template_id = '' # a non-legacy template id | ||
mail.from = Email.new(email: '[email protected]') | ||
subject = 'Dynamic Template Data Hello World from the SendGrid Ruby Library' | ||
mail.subject = subject | ||
personalization = Personalization.new | ||
personalization.add_to(Email.new(email: '[email protected]', name: 'Example User')) | ||
personalization.add_dynamic_template_data({ | ||
"variable" => [ | ||
{"foo" => "bar"}, {"foo" => "baz"} | ||
] | ||
}) | ||
mail.add_personalization(personalization) | ||
end | ||
|
||
hello_world | ||
kitchen_sink | ||
dynamic_template_data_hello_world | ||
|
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
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
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