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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d17dad76914ac60b33809ebc1d2e40f75dce01be
4
- data.tar.gz: affa262caeaf2a165a86ab0f0d1dccc8ebd58134
2
+ SHA256:
3
+ metadata.gz: 3f9c2f0f6c8194fd2b536c9d8291ac6500d5ba214963974a30043dfdf16cc718
4
+ data.tar.gz: 5094dd6c689a99af282d3ee9dd7ee1bce1deb7520929985a63e6b1c509907dd4
5
5
  SHA512:
6
- metadata.gz: 5875c6572ae0cdfa7bd0e80a9a327ddec318b2aa0c11137fd0afcef873c8941c96eb8ba44e7106e15449638198fb38f21341a13c899125b2dd1aaac50c87a880
7
- data.tar.gz: 59a593149aaf3b2173b337da4b2d815c7aba9dfee98685c9953fe0fab6109375d9cabf848c46a20cfff3021c34cd593a2d8095e4e1037f0d09dbfc3cd1a689be
6
+ metadata.gz: b331362c913e3220af8f2a942d75d7338b22d6f95183da8b761cb2fd950eed1dc52fc4864deec4ff8038099f5b1eefa2f1a01164083fcc97e225f3c85434a25c
7
+ data.tar.gz: 31ffb2a31a081e1ee29ee28d8c0b3273489982bb74ad9be01a14ae546a39430804ef22be546b69a6b257e2475267a529ffa591946ac81d859a66540baa1e217c
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  doc/*
6
6
  pkg/*
7
7
  api_keys.yml
8
+ coverage/
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 [Multimap] the message headers in Mailgun format
9
+ # @return [Hash] the message headers in Mailgun format
10
10
  def mailgun_headers
11
- hash = Multimap.new
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
- hash["h:#{field.name}"] = field.value
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
- hash
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
- hash = Multimap.new
33
+ map = Multimap.new
27
34
  attachments.each do |attachment|
28
35
  key = attachment.content_type.start_with?('image/') ? 'inline' : 'attachment'
29
- hash[key] = Faraday::UploadIO.new(StringIO.new(attachment.body.decoded), attachment.content_type, attachment.filename)
36
+ map[key] = Faraday::UploadIO.new(StringIO.new(attachment.body.decoded), attachment.content_type, attachment.filename)
30
37
  end
31
- hash
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
- hash = Multimap.new
46
+ map = Multimap.new
47
+ hash = Hash.new
40
48
 
41
49
  %w(from subject).each do |field|
42
50
  if self[field]
43
- hash[field] = self[field].value
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
- hash[field] = value
59
+ map[field] = value
52
60
  end
53
61
  else
54
- hash[field] = self[field].value
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
- hash['text'] = body_text
68
+ map['text'] = body_text
61
69
  end
62
70
  if body_html && !body_html.empty?
63
- hash['html'] = body_html
71
+ map['html'] = body_html
64
72
  end
65
73
 
66
74
  tags.each do |tag|
67
- hash['o:tag'] = tag
75
+ map['o:tag'] = tag
68
76
  end
69
77
 
70
- normalize(hash.merge(mailgun_attachments).merge(mailgun_headers).to_hash)
78
+ normalize(map.merge(mailgun_attachments).to_hash.merge(mailgun_headers).merge(hash))
71
79
  end
72
80
  end
73
81
  end
@@ -1,3 +1,3 @@
1
1
  module MultiMail
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -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.0')
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', '~> 2.10')
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 == ['noreply@example.com']
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 == ['noreply@example.com']
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,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe MultiMail::Message::Mandrill do
3
+ xdescribe MultiMail::Message::Mandrill do
4
4
  let :message do
5
5
  headers = {
6
6
  'X-Autoreply' => true,
@@ -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
- describe MultiMail::Receiver::Mandrill do
4
+ xdescribe MultiMail::Receiver::Mandrill do
5
5
  def params(fixture)
6
6
  MultiMail::Receiver::Mandrill.parse(response('mandrill', fixture))
7
7
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe MultiMail::Sender::Mandrill do
3
+ xdescribe MultiMail::Sender::Mandrill do
4
4
  let :message do
5
5
  Mail.new do
6
6
  from 'foo@example.com'
@@ -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, 'Bad or missing Server API token.')
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.6
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: 2016-03-08 00:00:00.000000000 Z
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.0
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.0
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: '2.10'
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: '2.10'
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.4.5
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: