Skip to content

Commit

Permalink
Improve format of SendGridHelper docs (beam-community#611)
Browse files Browse the repository at this point in the history
Improves format of SendgridHelper docs, including
an incorrect indentation in code sample that caused 
to be formatted incorrectly.
  • Loading branch information
mrcasals committed Jun 25, 2021
1 parent 012171b commit 75569aa
Showing 1 changed file with 36 additions and 28 deletions.
64 changes: 36 additions & 28 deletions lib/bamboo/adapters/send_grid_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ defmodule Bamboo.SendGridHelper do
end

@doc """
An array of category names for this email. A maximum of 10 categories can be assigned to an email.
Duplicate categories will be ignored and only unique entries will be sent.
Sets a list of categories for this email.
A maximum of 10 categories can be assigned to an email. Duplicate categories will
be ignored and only unique entries will be sent.
## Example
Expand All @@ -87,6 +89,7 @@ defmodule Bamboo.SendGridHelper do

@doc """
Add a property to the list of dynamic template data in the SendGrid template.
This will be added to the request as:
```
Expand All @@ -104,7 +107,6 @@ defmodule Bamboo.SendGridHelper do
],
```
The tag can be of any type since SendGrid allows you to use Handlebars in its templates
## Example
Expand All @@ -126,7 +128,8 @@ defmodule Bamboo.SendGridHelper do
do: raise("expected the name parameter to be of type binary or atom, got #{field}")

@doc """
An integer id for an ASM (Advanced Suppression Manager) group that this email should belong to.
Set the ASM (Advanced Suppression Manager) group that this email should belong to.
This can be used to let recipients unsubscribe from only a certain type of communication.
## Example
Expand All @@ -144,8 +147,9 @@ defmodule Bamboo.SendGridHelper do
end

@doc """
A boolean setting to instruct SendGrid to bypass list management for this
email. If enabled, SendGrid will ignore any email supression (such as
Instruct SendGrid to bypass list management for this email.
If enabled, SendGrid will ignore any email supression (such as
unsubscriptions, bounces, spam filters) for this email. This is useful for
emails that all users must receive, such as Terms of Service updates, or
password resets.
Expand All @@ -166,8 +170,10 @@ defmodule Bamboo.SendGridHelper do

@doc """
Instruct SendGrid to enable or disable Google Analytics tracking, and
optionally set the UTM parameters for it. This is useful if you need to
control UTM tracking parameters on an individual email basis.
optionally set the UTM parameters for it.
This is useful if you need to control UTM tracking parameters on an individual email
basis.
## Example
Expand Down Expand Up @@ -225,7 +231,7 @@ defmodule Bamboo.SendGridHelper do
end

@doc """
Add SendGrid personalizations
Add SendGrid personalizations.
Each personalization can have the following fields: `to`, `cc`, `bcc`,
`subject`, `headers`, `substitutions`, `custom_args`, or `send_at`.
Expand All @@ -238,24 +244,24 @@ defmodule Bamboo.SendGridHelper do
## Example:
base_personalization = %{
bcc: [%{"email" => "[email protected]", "name" => "BCC"}],
subject: "Here is your email"
}
personalizations =
Enum.map(
[
%{to: "[email protected]"},
%{to: "[email protected]", send_at: 1_580_485_560}
],
&Map.merge(base_personalization, &1)
)
email =
new_email()
|> Email.put_header("Reply-To", "[email protected]")
|> Bamboo.SendGridHelper.add_personalizations(personalizations)
base_personalization = %{
bcc: [%{"email" => "[email protected]", "name" => "BCC"}],
subject: "Here is your email"
}
personalizations =
Enum.map(
[
%{to: "[email protected]"},
%{to: "[email protected]", send_at: 1_580_485_560}
],
&Map.merge(base_personalization, &1)
)
email =
new_email()
|> Email.put_header("Reply-To", "[email protected]")
|> Bamboo.SendGridHelper.add_personalizations(personalizations)
"""
@spec add_personalizations(Bamboo.Email.t(), [map]) :: Bamboo.Email.t()
Expand Down Expand Up @@ -297,7 +303,9 @@ defmodule Bamboo.SendGridHelper do
end

@doc """
A map of unique arguments for this email. This will override any existing unique arguments.
Set a map of unique arguments for this email.
This will override any existing unique arguments.
## Example
Expand Down

0 comments on commit 75569aa

Please sign in to comment.