sendgrid-mailer 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5990e941d9695eaac104b8c0165bfeeb70913d6b
4
- data.tar.gz: f4aef07ff23c51aec6c33816f71045592e21a9d4
3
+ metadata.gz: fca05509f6afcd530fd2c5a702208c59cba2767b
4
+ data.tar.gz: 8876c3b9d1db2673a36b6a55e6747e61c93b27ce
5
5
  SHA512:
6
- metadata.gz: 72d972f52f9cad8c90858df1a461921b0a4f6723a7af95fcad04d909ccd5944e216f6182a6860ae61d84d81103b13968a0787e312412b3c8ca64cb1f6862143d
7
- data.tar.gz: adc2bb8a11701b984e65f8d609a0b55afeb3fdff52c55251f75d33555a23a8675ece8de7aa4efe6a154109898a6d146841a9b07a67632ea2f30940079b58a8cd
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
+ ```
@@ -1,5 +1,5 @@
1
1
  module Sendgrid
2
2
  class Mailer
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
@@ -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.6
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-30 00:00:00.000000000 Z
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:
Binary file