multi_mail 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 +5 -5
- data/.gitignore +1 -0
- data/README.md +0 -1
- data/lib/multi_mail/mailgun/message.rb +23 -15
- data/lib/multi_mail/version.rb +1 -1
- data/multi_mail.gemspec +4 -3
- data/spec/mailgun/message_spec.rb +2 -2
- data/spec/mandrill/message_spec.rb +1 -1
- data/spec/mandrill/receiver_spec.rb +1 -1
- data/spec/mandrill/sender_spec.rb +1 -1
- data/spec/postmark/sender_spec.rb +1 -1
- metadata +25 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f9c2f0f6c8194fd2b536c9d8291ac6500d5ba214963974a30043dfdf16cc718
|
4
|
+
data.tar.gz: 5094dd6c689a99af282d3ee9dd7ee1bce1deb7520929985a63e6b1c509907dd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b331362c913e3220af8f2a942d75d7338b22d6f95183da8b761cb2fd950eed1dc52fc4864deec4ff8038099f5b1eefa2f1a01164083fcc97e225f3c85434a25c
|
7
|
+
data.tar.gz: 31ffb2a31a081e1ee29ee28d8c0b3273489982bb74ad9be01a14ae546a39430804ef22be546b69a6b257e2475267a529ffa591946ac81d859a66540baa1e217c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/multi_mail.svg)](https://badge.fury.io/rb/multi_mail)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/jpmckinney/multi_mail.png)](https://travis-ci.org/jpmckinney/multi_mail)
|
5
|
-
[![Dependency Status](https://gemnasium.com/jpmckinney/multi_mail.png)](https://gemnasium.com/jpmckinney/multi_mail)
|
6
5
|
[![Coverage Status](https://coveralls.io/repos/jpmckinney/multi_mail/badge.png)](https://coveralls.io/r/jpmckinney/multi_mail)
|
7
6
|
[![Code Climate](https://codeclimate.com/github/jpmckinney/multi_mail.png)](https://codeclimate.com/github/jpmckinney/multi_mail)
|
8
7
|
|
@@ -6,16 +6,23 @@ module MultiMail
|
|
6
6
|
|
7
7
|
# Returns the message headers in Mailgun format.
|
8
8
|
#
|
9
|
-
# @return [
|
9
|
+
# @return [Hash] the message headers in Mailgun format
|
10
10
|
def mailgun_headers
|
11
|
-
|
11
|
+
map = Multimap.new
|
12
|
+
hash = Hash.new
|
13
|
+
|
12
14
|
header_fields.each do |field|
|
13
15
|
key = field.name.downcase
|
14
16
|
unless %w(from to cc bcc subject tag).include?(key)
|
15
|
-
|
17
|
+
if key == 'reply-to'
|
18
|
+
hash["h:#{field.name}"] = field.value
|
19
|
+
else
|
20
|
+
map["h:#{field.name}"] = field.value
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
|
-
|
24
|
+
|
25
|
+
map.to_hash.merge(hash)
|
19
26
|
end
|
20
27
|
|
21
28
|
# Returns the message's attachments in Mailgun format.
|
@@ -23,12 +30,12 @@ module MultiMail
|
|
23
30
|
# @return [Multimap] the attachments in Mailgun format
|
24
31
|
# @see http://documentation.mailgun.com/user_manual.html#inline-image
|
25
32
|
def mailgun_attachments
|
26
|
-
|
33
|
+
map = Multimap.new
|
27
34
|
attachments.each do |attachment|
|
28
35
|
key = attachment.content_type.start_with?('image/') ? 'inline' : 'attachment'
|
29
|
-
|
36
|
+
map[key] = Faraday::UploadIO.new(StringIO.new(attachment.body.decoded), attachment.content_type, attachment.filename)
|
30
37
|
end
|
31
|
-
|
38
|
+
map
|
32
39
|
end
|
33
40
|
|
34
41
|
# Returns the message as parameters to POST to Mailgun.
|
@@ -36,11 +43,12 @@ module MultiMail
|
|
36
43
|
# @return [Hash] the message as parameters to POST to Mailgun
|
37
44
|
# @see http://documentation.mailgun.com/user_manual.html#tagging
|
38
45
|
def to_mailgun_hash
|
39
|
-
|
46
|
+
map = Multimap.new
|
47
|
+
hash = Hash.new
|
40
48
|
|
41
49
|
%w(from subject).each do |field|
|
42
50
|
if self[field]
|
43
|
-
|
51
|
+
map[field] = self[field].value
|
44
52
|
end
|
45
53
|
end
|
46
54
|
|
@@ -48,26 +56,26 @@ module MultiMail
|
|
48
56
|
if self[field]
|
49
57
|
if self[field].value.respond_to?(:each)
|
50
58
|
self[field].value.each do |value|
|
51
|
-
|
59
|
+
map[field] = value
|
52
60
|
end
|
53
61
|
else
|
54
|
-
|
62
|
+
map[field] = self[field].value
|
55
63
|
end
|
56
64
|
end
|
57
65
|
end
|
58
66
|
|
59
67
|
if body_text && !body_text.empty?
|
60
|
-
|
68
|
+
map['text'] = body_text
|
61
69
|
end
|
62
70
|
if body_html && !body_html.empty?
|
63
|
-
|
71
|
+
map['html'] = body_html
|
64
72
|
end
|
65
73
|
|
66
74
|
tags.each do |tag|
|
67
|
-
|
75
|
+
map['o:tag'] = tag
|
68
76
|
end
|
69
77
|
|
70
|
-
normalize(
|
78
|
+
normalize(map.merge(mailgun_attachments).to_hash.merge(mailgun_headers).merge(hash))
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
data/lib/multi_mail/version.rb
CHANGED
data/multi_mail.gemspec
CHANGED
@@ -15,20 +15,21 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
|
18
|
-
s.add_runtime_dependency('faraday', '~> 0.9
|
18
|
+
s.add_runtime_dependency('faraday', '~> 0.9')
|
19
19
|
s.add_runtime_dependency('mail', '~> 2.5')
|
20
20
|
s.add_runtime_dependency('rack')
|
21
21
|
|
22
22
|
# For testing
|
23
23
|
s.add_development_dependency('actionmailer', '~> 4.2.1')
|
24
24
|
s.add_development_dependency('coveralls')
|
25
|
-
s.add_development_dependency('rake')
|
26
|
-
s.add_development_dependency('rspec', '~>
|
25
|
+
s.add_development_dependency('rake', '< 11.0')
|
26
|
+
s.add_development_dependency('rspec', '~> 3.0')
|
27
27
|
|
28
28
|
# For Rake tasks
|
29
29
|
s.add_development_dependency('mandrill-api', '~> 1.0.35')
|
30
30
|
s.add_development_dependency('postmark')
|
31
31
|
s.add_development_dependency('rest-client', '~> 1.8.0')
|
32
|
+
s.add_development_dependency('tins', '< 1.7')
|
32
33
|
# sendgrid_webapi 0.0.2 depends on Faraday 0.8.
|
33
34
|
# s.add_development_dependency('sendgrid_webapi', '0.0.2')
|
34
35
|
end
|
@@ -182,7 +182,7 @@ describe MultiMail::Message::Mailgun do
|
|
182
182
|
describe '#mailgun_headers' do
|
183
183
|
it 'should return the headers' do
|
184
184
|
headers = message.mailgun_headers
|
185
|
-
headers['h:Reply-To'].should ==
|
185
|
+
headers['h:Reply-To'].should == 'noreply@example.com'
|
186
186
|
headers['h:X-Autoreply'].should == ['true']
|
187
187
|
headers['h:X-Precedence'].should == ['auto_reply']
|
188
188
|
headers['h:X-Numeric'].should == ['42']
|
@@ -215,7 +215,7 @@ describe MultiMail::Message::Mailgun do
|
|
215
215
|
hash[:subject].should == ['test']
|
216
216
|
hash[:text].should == ['hello']
|
217
217
|
hash[:html].should == ['<p>hello</p>']
|
218
|
-
hash[:'h:Reply-To'].should ==
|
218
|
+
hash[:'h:Reply-To'].should == 'noreply@example.com'
|
219
219
|
|
220
220
|
Time.parse(hash[:'h:Date'][0]).should be_within(1).of(Time.at(946702800))
|
221
221
|
hash[:'h:Content-Type'][0].should match(%r{\Amultipart/alternative; boundary=--==_mimepart_[0-9a-f_]+\z})
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
require 'multi_mail/mandrill/receiver'
|
3
3
|
|
4
|
-
|
4
|
+
xdescribe MultiMail::Receiver::Mandrill do
|
5
5
|
def params(fixture)
|
6
6
|
MultiMail::Receiver::Mandrill.parse(response('mandrill', fixture))
|
7
7
|
end
|
@@ -65,7 +65,7 @@ describe MultiMail::Sender::Postmark do
|
|
65
65
|
expect{
|
66
66
|
message.delivery_method MultiMail::Sender::Postmark, :api_key => 'xxx'
|
67
67
|
message.deliver
|
68
|
-
}.to raise_error(MultiMail::InvalidAPIKey, '
|
68
|
+
}.to raise_error(MultiMail::InvalidAPIKey, 'The Server Token you provided in the X-Postmark-Server-Token request header was invalid. Please verify that you are using a valid token.')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_mail
|
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 McKinney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.9
|
19
|
+
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.9
|
26
|
+
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mail
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,30 +84,30 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "<"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '11.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "<"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '11.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mandrill-api
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.8.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: tins
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "<"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.7'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "<"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.7'
|
153
167
|
description:
|
154
168
|
email:
|
155
169
|
executables:
|
@@ -266,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
280
|
version: '0'
|
267
281
|
requirements: []
|
268
282
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
283
|
+
rubygems_version: 2.7.6
|
270
284
|
signing_key:
|
271
285
|
specification_version: 4
|
272
286
|
summary: Easily switch between email APIs
|
@@ -326,4 +340,3 @@ test_files:
|
|
326
340
|
- spec/service_spec.rb
|
327
341
|
- spec/simple/receiver_spec.rb
|
328
342
|
- spec/spec_helper.rb
|
329
|
-
has_rdoc:
|