sendgrid-mailer 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -0
- data/lib/sendgrid/mailer/version.rb +1 -1
- data/lib/sendgrid/mailer.rb +7 -1
- metadata +2 -3
- data/sendgrid-mailer-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca05509f6afcd530fd2c5a702208c59cba2767b
|
4
|
+
data.tar.gz: 8876c3b9d1db2673a36b6a55e6747e61c93b27ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512d134b2e37748457a5c0985d12369aa884ae1ef84785b6a12591e5963961aba74d6994ff315c6f2e31cb96f33dad1253fa769485520edd61c71f314b82664a
|
7
|
+
data.tar.gz: 04128a33fae1cdaa8cfa6599d506ec56adc5da9e9389964ee1f58eafb58f8d936e6658b71979460270035d9fec05aa35b04f82426b244f4efcefca5d0e032086
|
data/README.md
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
This is a simple helper used as a proof of concept to allow more complex JSON structures with the sendgrid templating system
|
2
|
+
|
3
|
+
Allows you to easily find templates and provide variables to the templating system
|
4
|
+
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
mail_options = {
|
8
|
+
to: user.email,
|
9
|
+
template_id: Mailers::SendgridTemplateHelper.get_id_for(:email_confirmation, user.locale),
|
10
|
+
substitutions: {
|
11
|
+
username: user.email.split('@')[0],
|
12
|
+
confirmation_url: confirmation_url(user, confirmation_token: token || user.confirmation_token),
|
13
|
+
},
|
14
|
+
}.merge(options)
|
15
|
+
sendgrid_mail(mail_options)
|
16
|
+
```
|
17
|
+
|
18
|
+
```
|
19
|
+
Mailers::SendgridTemplateHelper.get_id_for
|
20
|
+
# Returns the sendgrid id for a specific template (currently coming from a yml file)
|
21
|
+
```
|
22
|
+
|
23
|
+
```
|
24
|
+
sendgrid_mail
|
25
|
+
# creates the json and makes the post request to sendgrid
|
26
|
+
```
|
data/lib/sendgrid/mailer.rb
CHANGED
@@ -7,10 +7,12 @@ module Sendgrid
|
|
7
7
|
class Mailer
|
8
8
|
include SendGrid
|
9
9
|
|
10
|
-
def initialize(api_key, from, bcc)
|
10
|
+
def initialize(api_key, from, bcc, sandbox_mode: false, dev_catch_all:)
|
11
11
|
@api_key = api_key
|
12
12
|
@from = from
|
13
13
|
@bcc = bcc
|
14
|
+
@sandbox_mode = sandbox_mode
|
15
|
+
@dev_catch_all = dev_catch_all
|
14
16
|
end
|
15
17
|
|
16
18
|
def build_mail_json(template_id:, to: nil, from: nil, bcc: nil, substitutions: {}, options: {})
|
@@ -18,6 +20,10 @@ module Sendgrid
|
|
18
20
|
force_send: false,
|
19
21
|
}.merge(options)
|
20
22
|
|
23
|
+
if @dev_catch_all
|
24
|
+
to = @dev_catch_all
|
25
|
+
end
|
26
|
+
|
21
27
|
SendGrid::Mail.new.tap do |m|
|
22
28
|
m.from = build_from(from)
|
23
29
|
m.template_id = template_id if template_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendgrid-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Watling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- lib/sendgrid/mailer.rb
|
71
71
|
- lib/sendgrid/mailer/version.rb
|
72
72
|
- lib/sendgrid/template.rb
|
73
|
-
- sendgrid-mailer-0.1.0.gem
|
74
73
|
- sendgrid-mailer.gemspec
|
75
74
|
homepage: https://www.jameswatling.com
|
76
75
|
licenses:
|
data/sendgrid-mailer-0.1.0.gem
DELETED
Binary file
|