sendgrid-actionmailer 0.1.1 → 0.2.0

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: 44c5c216019a73007baba29b9b5450462bbb2c1e
4
- data.tar.gz: 829fd2abebfe9a8df103d08eca23deb8134497e3
3
+ metadata.gz: 439cfb2a51ff36ec5c65b6848312d86ec545d51f
4
+ data.tar.gz: da68fced610264b8bb73fef05fa20e419fae45c7
5
5
  SHA512:
6
- metadata.gz: 57619a1532efc305dd82c2d13eab842f5c290703893c98398f03a0f1b69f564e01408869f55ba7c77087d0786265cd11db6f471eea26cc76cc7227c0d89c7f50
7
- data.tar.gz: 27f6f546ddecd1e3f8f2538047f72435a8d6931b867361bccf3bb3ed4c201a22cb1a2f570b29c7723bfd016038938920ffa0d3d29c72d831668c8940eea877ce
6
+ metadata.gz: f26257a6de567602003ea7d15f179a9336ddabdcec1bb7708449c6bba22a8e47c26a5f2ff692d747e02c4af3907c271a9b1da0aa0d56c1e8fef8d52be776bf96
7
+ data.tar.gz: 38106c76e663f6d43c0e00a18722560f0d1847c17c544fff7b19cdb44d34450d435a0c9b073dd152fb4c3b180e38ba310cdb0ec20b5a30ffa00ee58a7c3f4d32
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Change Log
2
+
3
+ ## 0.2.0 - 2016-04-25
4
+
5
+ ### Added
6
+
7
+ - Support for `reply_to` and `date` options.
8
+
9
+ ### Fixed
10
+
11
+ - Fix sending when multiple `X-SMTPAPI` headers are set.
12
+
13
+ ## 0.1.1 - 2016-04-25
14
+
15
+ ### Fixed
16
+
17
+ - Fix file attachments.
18
+
19
+ ## 0.1.0 - 2016-04-23
20
+
21
+ ### Added
22
+
23
+ - Support for `cc` and `bcc` options.
24
+ - Support the `X-SMTPAPI` header.
25
+
26
+ ### Changed
27
+
28
+ - Compatibility with `sendgrid-ruby` v1.0.
29
+ - Compatibility with `mail` v2.6.
30
+
31
+ ### Fixed
32
+
33
+ - Fix `From` addresses with display names.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- sendgrid-actionmailer (0.1.1)
4
+ sendgrid-actionmailer (0.2.0)
5
5
  mail (~> 2.5)
6
6
  sendgrid-ruby (< 2.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- sendgrid-actionmailer (0.1.1)
4
+ sendgrid-actionmailer (0.2.0)
5
5
  mail (~> 2.5)
6
6
  sendgrid-ruby (< 2.0)
7
7
 
@@ -26,10 +26,24 @@ module SendGridActionMailer
26
26
  m.bcc = mail[:bcc].addresses if mail[:bcc]
27
27
  m.from = from.address
28
28
  m.from_name = from.display_name
29
+ m.reply_to = mail[:reply_to].addresses.first if mail[:reply_to]
30
+ m.date = mail[:date].to_s if mail[:date]
29
31
  m.subject = mail.subject
30
32
  end
31
33
 
32
34
  smtpapi = mail['X-SMTPAPI']
35
+
36
+ # If multiple X-SMTPAPI headers are present on the message, then pick the
37
+ # first one. This may happen when X-SMTPAPI is set with defaults at the
38
+ # class-level (using defaults()), as well as inside an individual method
39
+ # (using headers[]=). In this case, we'll defer to the more specific
40
+ # header set in the individual method, which is the first header
41
+ # (somewhat counter-intuitively:
42
+ # https://github.com/rails/rails/issues/15912).
43
+ if(smtpapi.kind_of?(Array))
44
+ smtpapi = smtpapi.first
45
+ end
46
+
33
47
  if smtpapi && smtpapi.value
34
48
  begin
35
49
  data = JSON.parse(smtpapi.value)
@@ -1,3 +1,3 @@
1
1
  module SendGridActionMailer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -65,6 +65,33 @@ module SendGridActionMailer
65
65
  end
66
66
  end
67
67
 
68
+ context 'there is a reply to' do
69
+ before { mail.reply_to = 'nachos@cat.limo' }
70
+
71
+ it 'sets reply_to' do
72
+ mailer.deliver!(mail)
73
+ expect(client.sent_mail.reply_to).to eq('nachos@cat.limo')
74
+ end
75
+ end
76
+
77
+ context 'there is a reply to with a friendly name' do
78
+ before { mail.reply_to = 'Taco Cat <nachos@cat.limo>' }
79
+
80
+ it 'sets reply_to' do
81
+ mailer.deliver!(mail)
82
+ expect(client.sent_mail.reply_to).to eq('nachos@cat.limo')
83
+ end
84
+ end
85
+
86
+ context 'there is a date' do
87
+ before { mail.date = Time.utc(2016) }
88
+
89
+ it 'sets date' do
90
+ mailer.deliver!(mail)
91
+ expect(client.sent_mail.date).to eq("Fri, 01 Jan 2016 00:00:00 +0000")
92
+ end
93
+ end
94
+
68
95
  it 'sets from' do
69
96
  mailer.deliver!(mail)
70
97
  expect(client.sent_mail.from).to eq('taco@cat.limo')
@@ -362,6 +389,18 @@ module SendGridActionMailer
362
389
  expect(client.sent_mail.smtpapi.ip_pool).to eq("pool_name")
363
390
  end
364
391
  end
392
+
393
+ context 'multiple X-SMTPAPI headers are present' do
394
+ before do
395
+ mail['X-SMTPAPI'] = { category: 'food_canine' }.to_json
396
+ mail['X-SMTPAPI'] = { category: 'food_feline' }.to_json
397
+ end
398
+
399
+ it 'uses the last header' do
400
+ mailer.deliver!(mail)
401
+ expect(client.sent_mail.smtpapi.category).to eq('food_canine')
402
+ end
403
+ end
365
404
  end
366
405
  end
367
406
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddie Zaneski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-04-25 00:00:00.000000000 Z
13
+ date: 2016-04-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mail
@@ -123,6 +123,7 @@ files:
123
123
  - ".rspec"
124
124
  - ".travis.yml"
125
125
  - Appraisals
126
+ - CHANGELOG.md
126
127
  - Gemfile
127
128
  - LICENSE.txt
128
129
  - README.md