sendgrid-actionmailer 0.1.0 → 0.1.1
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 +4 -4
- data/gemfiles/mail_2.5.gemfile.lock +20 -17
- data/gemfiles/mail_2.6.gemfile.lock +20 -17
- data/lib/sendgrid_actionmailer/version.rb +1 -1
- data/lib/sendgrid_actionmailer.rb +17 -10
- data/sendgrid-actionmailer.gemspec +3 -2
- data/spec/lib/sendgrid_actionmailer_spec.rb +9 -2
- metadata +21 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44c5c216019a73007baba29b9b5450462bbb2c1e
|
|
4
|
+
data.tar.gz: 829fd2abebfe9a8df103d08eca23deb8134497e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 57619a1532efc305dd82c2d13eab842f5c290703893c98398f03a0f1b69f564e01408869f55ba7c77087d0786265cd11db6f471eea26cc76cc7227c0d89c7f50
|
|
7
|
+
data.tar.gz: 27f6f546ddecd1e3f8f2538047f72435a8d6931b867361bccf3bb3ed4c201a22cb1a2f570b29c7723bfd016038938920ffa0d3d29c72d831668c8940eea877ce
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../
|
|
3
3
|
specs:
|
|
4
|
-
sendgrid-actionmailer (0.
|
|
4
|
+
sendgrid-actionmailer (0.1.1)
|
|
5
5
|
mail (~> 2.5)
|
|
6
|
-
sendgrid-ruby (
|
|
6
|
+
sendgrid-ruby (< 2.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
+
addressable (2.4.0)
|
|
11
12
|
appraisal (2.1.0)
|
|
12
13
|
bundler
|
|
13
14
|
rake
|
|
14
15
|
thor (>= 0.14.0)
|
|
16
|
+
crack (0.4.3)
|
|
17
|
+
safe_yaml (~> 1.0.0)
|
|
15
18
|
diff-lcs (1.2.5)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
domain_name (~> 0.5)
|
|
19
|
+
faraday (0.9.2)
|
|
20
|
+
multipart-post (>= 1.2, < 3)
|
|
21
|
+
hashdiff (0.3.0)
|
|
20
22
|
mail (2.5.4)
|
|
21
23
|
mime-types (~> 1.16)
|
|
22
24
|
treetop (~> 1.4.8)
|
|
23
25
|
mime-types (1.25.1)
|
|
24
|
-
|
|
26
|
+
mimemagic (0.3.1)
|
|
27
|
+
multipart-post (2.0.0)
|
|
25
28
|
polyglot (0.3.5)
|
|
26
29
|
rake (11.1.2)
|
|
27
|
-
rest-client (1.8.0)
|
|
28
|
-
http-cookie (>= 1.0.2, < 2.0)
|
|
29
|
-
mime-types (>= 1.16, < 3.0)
|
|
30
|
-
netrc (~> 0.7)
|
|
31
30
|
rspec (3.2.0)
|
|
32
31
|
rspec-core (~> 3.2.0)
|
|
33
32
|
rspec-expectations (~> 3.2.0)
|
|
@@ -41,17 +40,20 @@ GEM
|
|
|
41
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
42
41
|
rspec-support (~> 3.2.0)
|
|
43
42
|
rspec-support (3.2.2)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
safe_yaml (1.0.4)
|
|
44
|
+
sendgrid-ruby (1.1.6)
|
|
45
|
+
faraday (~> 0.9)
|
|
46
|
+
mimemagic
|
|
47
|
+
smtpapi (~> 0.1)
|
|
47
48
|
smtpapi (0.1.0)
|
|
48
49
|
thor (0.19.1)
|
|
49
50
|
treetop (1.4.15)
|
|
50
51
|
polyglot
|
|
51
52
|
polyglot (>= 0.3.1)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
webmock (1.24.6)
|
|
54
|
+
addressable (>= 2.3.6)
|
|
55
|
+
crack (>= 0.3.2)
|
|
56
|
+
hashdiff
|
|
55
57
|
|
|
56
58
|
PLATFORMS
|
|
57
59
|
ruby
|
|
@@ -63,6 +65,7 @@ DEPENDENCIES
|
|
|
63
65
|
rake
|
|
64
66
|
rspec (~> 3.2.0)
|
|
65
67
|
sendgrid-actionmailer!
|
|
68
|
+
webmock (~> 1.24.6)
|
|
66
69
|
|
|
67
70
|
BUNDLED WITH
|
|
68
71
|
1.11.2
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../
|
|
3
3
|
specs:
|
|
4
|
-
sendgrid-actionmailer (0.
|
|
4
|
+
sendgrid-actionmailer (0.1.1)
|
|
5
5
|
mail (~> 2.5)
|
|
6
|
-
sendgrid-ruby (
|
|
6
|
+
sendgrid-ruby (< 2.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
+
addressable (2.4.0)
|
|
11
12
|
appraisal (2.1.0)
|
|
12
13
|
bundler
|
|
13
14
|
rake
|
|
14
15
|
thor (>= 0.14.0)
|
|
16
|
+
crack (0.4.3)
|
|
17
|
+
safe_yaml (~> 1.0.0)
|
|
15
18
|
diff-lcs (1.2.5)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
domain_name (~> 0.5)
|
|
19
|
+
faraday (0.9.2)
|
|
20
|
+
multipart-post (>= 1.2, < 3)
|
|
21
|
+
hashdiff (0.3.0)
|
|
20
22
|
mail (2.6.4)
|
|
21
23
|
mime-types (>= 1.16, < 4)
|
|
22
24
|
mime-types (2.99.1)
|
|
23
|
-
|
|
25
|
+
mimemagic (0.3.1)
|
|
26
|
+
multipart-post (2.0.0)
|
|
24
27
|
rake (11.1.2)
|
|
25
|
-
rest-client (1.8.0)
|
|
26
|
-
http-cookie (>= 1.0.2, < 2.0)
|
|
27
|
-
mime-types (>= 1.16, < 3.0)
|
|
28
|
-
netrc (~> 0.7)
|
|
29
28
|
rspec (3.2.0)
|
|
30
29
|
rspec-core (~> 3.2.0)
|
|
31
30
|
rspec-expectations (~> 3.2.0)
|
|
@@ -39,14 +38,17 @@ GEM
|
|
|
39
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
39
|
rspec-support (~> 3.2.0)
|
|
41
40
|
rspec-support (3.2.2)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
safe_yaml (1.0.4)
|
|
42
|
+
sendgrid-ruby (1.1.6)
|
|
43
|
+
faraday (~> 0.9)
|
|
44
|
+
mimemagic
|
|
45
|
+
smtpapi (~> 0.1)
|
|
45
46
|
smtpapi (0.1.0)
|
|
46
47
|
thor (0.19.1)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
webmock (1.24.6)
|
|
49
|
+
addressable (>= 2.3.6)
|
|
50
|
+
crack (>= 0.3.2)
|
|
51
|
+
hashdiff
|
|
50
52
|
|
|
51
53
|
PLATFORMS
|
|
52
54
|
ruby
|
|
@@ -58,6 +60,7 @@ DEPENDENCIES
|
|
|
58
60
|
rake
|
|
59
61
|
rspec (~> 3.2.0)
|
|
60
62
|
sendgrid-actionmailer!
|
|
63
|
+
webmock (~> 1.24.6)
|
|
61
64
|
|
|
62
65
|
BUNDLED WITH
|
|
63
66
|
1.11.2
|
|
@@ -17,6 +17,7 @@ module SendGridActionMailer
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def deliver!(mail)
|
|
20
|
+
attachment_tempfiles = []
|
|
20
21
|
from = mail[:from].addrs.first
|
|
21
22
|
|
|
22
23
|
email = SendGrid::Mail.new do |m|
|
|
@@ -87,20 +88,26 @@ module SendGridActionMailer
|
|
|
87
88
|
|
|
88
89
|
# This needs to be done better
|
|
89
90
|
mail.attachments.each do |a|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
end
|
|
91
|
+
# Create a tempfile with the same file extension as the real file
|
|
92
|
+
# for sendgrid-ruby's mime type lookups.
|
|
93
|
+
t = Tempfile.new(["sendgrid-actionmailer", File.extname(a.filename)])
|
|
94
|
+
t.binmode
|
|
95
|
+
t.write(a.read)
|
|
96
|
+
t.flush
|
|
97
|
+
t.rewind
|
|
98
|
+
email.add_attachment(t, a.filename)
|
|
99
|
+
attachment_tempfiles << t
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
client.send(email)
|
|
104
|
+
ensure
|
|
105
|
+
# Close and delete the attachment tempfiles after the e-mail has been
|
|
106
|
+
# sent.
|
|
107
|
+
attachment_tempfiles.each do |file|
|
|
108
|
+
file.close
|
|
109
|
+
file.unlink
|
|
110
|
+
end
|
|
104
111
|
end
|
|
105
112
|
end
|
|
106
113
|
end
|
|
@@ -6,8 +6,8 @@ require 'sendgrid_actionmailer/version'
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'sendgrid-actionmailer'
|
|
8
8
|
spec.version = SendGridActionMailer::VERSION
|
|
9
|
-
spec.authors = ['Eddie Zaneski']
|
|
10
|
-
spec.email = ['
|
|
9
|
+
spec.authors = ['Eddie Zaneski', 'Kristján Pétursson', 'Nick Muerdter']
|
|
10
|
+
spec.email = ['eddiezane@gmail.com', 'kristjan@gmail.com', 'stuff@nickm.org']
|
|
11
11
|
spec.summary = %q{SendGrid support for ActionMailer.}
|
|
12
12
|
spec.description = %q{Use ActionMailer with SendGrid's Web API.}
|
|
13
13
|
spec.homepage = 'https://github.com/eddiezane/sendgrid-actionmailer'
|
|
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.add_development_dependency 'rake'
|
|
26
26
|
spec.add_development_dependency 'rspec', '~>3.2.0'
|
|
27
27
|
spec.add_development_dependency 'appraisal', '~> 2.1.0'
|
|
28
|
+
spec.add_development_dependency 'webmock', '~> 1.24.6'
|
|
28
29
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'mail'
|
|
2
|
+
require 'webmock/rspec'
|
|
2
3
|
|
|
3
4
|
module SendGridActionMailer
|
|
4
5
|
describe DeliveryMethod do
|
|
@@ -6,11 +7,12 @@ module SendGridActionMailer
|
|
|
6
7
|
DeliveryMethod.new(api_user: 'user', api_key: 'key')
|
|
7
8
|
end
|
|
8
9
|
|
|
9
|
-
class TestClient
|
|
10
|
+
class TestClient < SendGrid::Client
|
|
10
11
|
attr_reader :sent_mail
|
|
11
12
|
|
|
12
13
|
def send(mail)
|
|
13
14
|
@sent_mail = mail
|
|
15
|
+
super(mail)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
|
@@ -34,7 +36,11 @@ module SendGridActionMailer
|
|
|
34
36
|
)
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
before
|
|
39
|
+
before do
|
|
40
|
+
stub_request(:any, 'https://api.sendgrid.com/api/mail.send.json')
|
|
41
|
+
.to_return(body: {message: 'success'}.to_json, status: 200, headers: {'X-TEST' => 'yes'})
|
|
42
|
+
allow(SendGrid::Client).to receive(:new).and_return(client)
|
|
43
|
+
end
|
|
38
44
|
|
|
39
45
|
it 'sets to' do
|
|
40
46
|
mailer.deliver!(mail)
|
|
@@ -156,6 +162,7 @@ module SendGridActionMailer
|
|
|
156
162
|
mailer.deliver!(mail)
|
|
157
163
|
attachment = client.sent_mail.attachments.first
|
|
158
164
|
expect(attachment[:name]).to eq('specs.rb')
|
|
165
|
+
expect(attachment[:file].content_type.to_s).to eq('application/x-ruby')
|
|
159
166
|
end
|
|
160
167
|
end
|
|
161
168
|
|
metadata
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sendgrid-actionmailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eddie Zaneski
|
|
8
|
+
- Kristján Pétursson
|
|
9
|
+
- Nick Muerdter
|
|
8
10
|
autorequire:
|
|
9
11
|
bindir: bin
|
|
10
12
|
cert_chain: []
|
|
11
|
-
date: 2016-04-
|
|
13
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
|
12
14
|
dependencies:
|
|
13
15
|
- !ruby/object:Gem::Dependency
|
|
14
16
|
name: mail
|
|
@@ -94,9 +96,25 @@ dependencies:
|
|
|
94
96
|
- - "~>"
|
|
95
97
|
- !ruby/object:Gem::Version
|
|
96
98
|
version: 2.1.0
|
|
99
|
+
- !ruby/object:Gem::Dependency
|
|
100
|
+
name: webmock
|
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - "~>"
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: 1.24.6
|
|
106
|
+
type: :development
|
|
107
|
+
prerelease: false
|
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
109
|
+
requirements:
|
|
110
|
+
- - "~>"
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
version: 1.24.6
|
|
97
113
|
description: Use ActionMailer with SendGrid's Web API.
|
|
98
114
|
email:
|
|
99
|
-
-
|
|
115
|
+
- eddiezane@gmail.com
|
|
116
|
+
- kristjan@gmail.com
|
|
117
|
+
- stuff@nickm.org
|
|
100
118
|
executables: []
|
|
101
119
|
extensions: []
|
|
102
120
|
extra_rdoc_files: []
|