griddler-mandrill 1.0.2 → 1.1.1

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
2
  SHA1:
3
- metadata.gz: b5734cf6f504c80285028a0c25dc9080553d99aa
4
- data.tar.gz: 6b0189f1ff8fda257ad92c9301bff5c88f46b19a
3
+ metadata.gz: 986e391f3565a7f5189859a92a3c939b69c0c6e2
4
+ data.tar.gz: 8f4c5abcec2a7b26503f101bac709bb32ca918eb
5
5
  SHA512:
6
- metadata.gz: bc106bc175e483060107cc6a931d0fa6dfd26534365364a1a726e7d8533d9bce5080efbdef5e396c2d7eedb628e42b290264f5fbe9119c43ec0f7b675868680f
7
- data.tar.gz: c0369360d8329cb6dd39011c6d7323ec6c7a102be4a31d299f5806228e817d13d48f25c451449c5a25196376fb4c26d31c3aa6737a6cfad3d2a1568ad1d7e00a
6
+ metadata.gz: 22c435ceb3b901cb4f5c867150dd8f7352292a67eb3c65c6de005cd99f34ffe9a94f9ea8c6f6c56176cc204e8bb4d43c23ac2a8412ff77c00be64bb656885879
7
+ data.tar.gz: 05073ddb3cbd1c4513174979e4ce5b318badc2a67362b1dd18c96044704059c927d4cdeecbd498afc793046e632a0379fa16ac251d638c987d7c61814450c024
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
+ sudo: false
2
+ cache: bundler
1
3
  language: ruby
2
4
  rvm:
3
5
  - 2.0
4
6
  - 2.1
7
+ - 2.2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.0.3 (master)
2
+ * Replace `nil` for email text/html values with empty strings. #10 via [calleerlandsson](https://github.com/calleerlandsson)
3
+
1
4
  ## 1.0.2
2
5
  * Replace slashes in filenames with underscores for temp file creation. #5 and
3
6
  #6 via [ssidelnikov](https://github.com/ssidelnikov)
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Stafford Brunk']
10
10
  spec.email = ['stafford.brunk@gmail.com']
11
11
  spec.summary = %q{Mandrill adapter for Griddler}
12
- spec.description = %q{Adapter to allow the use of Mandrill's Inboud Email Processing with Griddler}
12
+ spec.description = %q{Adapter to allow the use of Mandrill's Inbound Email Processing with Griddler}
13
13
  spec.homepage = 'https://github.com/wingrunr21/griddler-mandrill'
14
14
  spec.license = 'MIT'
15
15
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'griddler'
21
+ spec.add_dependency 'griddler', '>= 1.2.1'
22
22
 
23
23
  spec.add_development_dependency 'rspec'
24
24
  spec.add_development_dependency 'rake'
@@ -16,10 +16,11 @@ module Griddler
16
16
  to: recipients(:to, event),
17
17
  cc: recipients(:cc, event),
18
18
  bcc: recipients(:bcc, event),
19
+ headers: event[:headers],
19
20
  from: full_email([ event[:from_email], event[:from_name] ]),
20
21
  subject: event[:subject],
21
- text: event.fetch(:text, ''),
22
- html: event.fetch(:html, ''),
22
+ text: event[:text] || '',
23
+ html: event[:html] || '',
23
24
  raw_body: event[:raw_msg],
24
25
  attachments: attachment_files(event)
25
26
  }
@@ -1,5 +1,5 @@
1
1
  module Griddler
2
2
  module Mandrill
3
- VERSION = '1.0.2'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
@@ -25,6 +25,15 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
25
25
  end
26
26
  end
27
27
 
28
+ describe Griddler::Email do
29
+ it 'accepts the mandrill headers hash without error' do
30
+ params = mixed_event_params
31
+ params_to_send = Griddler::Mandrill::Adapter.normalize_params(params)
32
+ headers = Griddler::EmailParser.extract_headers(params_to_send.first[:headers])
33
+ expect{headers}.not_to raise_error
34
+ end
35
+ end
36
+
28
37
  it 'passes the received array of files' do
29
38
  params = params_with_attachments
30
39
 
@@ -80,6 +89,21 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
80
89
  end
81
90
  end
82
91
 
92
+ describe 'when the email text part is nil' do
93
+ before do
94
+ @params = params_hash
95
+ @params.first[:msg][:text] = nil
96
+ end
97
+
98
+ it 'sets :text to an empty string' do
99
+ params = default_params(@params)
100
+ normalized_params = Griddler::Mandrill::Adapter.normalize_params(params)
101
+ normalized_params.each do |p|
102
+ expect(p[:text]).to eq ''
103
+ end
104
+ end
105
+ end
106
+
83
107
  describe 'when the email has no html part' do
84
108
  before do
85
109
  @params = params_hash
@@ -95,6 +119,21 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
95
119
  end
96
120
  end
97
121
 
122
+ describe 'when the email html part is nil' do
123
+ before do
124
+ @params = params_hash
125
+ @params.first[:msg][:html] = nil
126
+ end
127
+
128
+ it 'sets :html to an empty string' do
129
+ params = default_params(@params)
130
+ normalized_params = Griddler::Mandrill::Adapter.normalize_params(params)
131
+ normalized_params.each do |p|
132
+ expect(p[:html]).to eq ''
133
+ end
134
+ end
135
+ end
136
+
98
137
  describe 'when the email has no CC recipients' do
99
138
  before do
100
139
  @params = params_hash
@@ -148,7 +187,9 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
148
187
  msg:
149
188
  {
150
189
  raw_msg: 'raw',
151
- headers: {},
190
+ headers: {"X-Mailer" => "Airmail (271)",
191
+ "Mime-Version" => "1.0",
192
+ "Content-Type" => "multipart/alternative; boundary=\"546876a7_66334873_aa8\""},
152
193
  text: text_body,
153
194
  html: text_html,
154
195
  from_email: 'hernan@example.com',
@@ -178,6 +219,9 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
178
219
  'Joey <joey@example.mandrillapp.com>'],
179
220
  bcc: ['Roger <hidden@example.mandrillapp.com>'],
180
221
  from: 'Hernan Example <hernan@example.com>',
222
+ headers: {"X-Mailer" => "Airmail (271)",
223
+ "Mime-Version" => "1.0",
224
+ "Content-Type" => "multipart/alternative; boundary=\"546876a7_66334873_aa8\""},
181
225
  subject: 'hello',
182
226
  text: %r{Dear bob},
183
227
  html: %r{<p>Dear bob</p>},
@@ -278,7 +322,6 @@ describe Griddler::Mandrill::Adapter, '.normalize_params' do
278
322
  {
279
323
  name: '=?UTF-8?B?0JrQvtC/0LjRjyB0ZW5kZXJfMTJfcm9zdGEueGxz?=',
280
324
  content: content,
281
- type: 'image/jpeg',
282
325
  type: 'text/plain',
283
326
  base64: false
284
327
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: griddler-mandrill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stafford Brunk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: griddler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.1
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'
26
+ version: 1.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Adapter to allow the use of Mandrill's Inboud Email Processing with Griddler
69
+ description: Adapter to allow the use of Mandrill's Inbound Email Processing with
70
+ Griddler
70
71
  email:
71
72
  - stafford.brunk@gmail.com
72
73
  executables: []
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  version: '0'
109
110
  requirements: []
110
111
  rubyforge_project:
111
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.4.8
112
113
  signing_key:
113
114
  specification_version: 4
114
115
  summary: Mandrill adapter for Griddler