mandrill_mailer 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +2 -0
- data/lib/mandrill_mailer/arg_formatter.rb +3 -1
- data/lib/mandrill_mailer/version.rb +1 -1
- data/spec/arg_formatter_spec.rb +35 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413e3b48c2e8f81449c0d426c5184b64523bc09b
|
4
|
+
data.tar.gz: 43cd6aaff9e74945faf6070da60fb41e6f9a00f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f99d80385837a0bde6f8b32182044ce76dac55e3f6bff62a9d544f48f01c3281b25dfb0b5840a25dc477835a864f0886dd2eaaa354f43aed494e87439c38f3ef
|
7
|
+
data.tar.gz: b3c5407a1869fd50aeb4636b8e4bde403eb1e619b762d28282975a3f806114d27fb1d64552ed67535f32df05f4abb707d0dfe121cd99a99fea37eb7028247938
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## 1.6.0 - 2017-03-23
|
6
|
+
- Add support for attaching unencoded content via @brunomperes
|
7
|
+
|
5
8
|
## 1.5.0 - 2017-03-20
|
6
9
|
- Update offline adapter for testing to be more compatible with Rails 5 via @eric1234
|
7
10
|
|
data/README.md
CHANGED
@@ -153,11 +153,13 @@ end
|
|
153
153
|
|
154
154
|
* `:attachments` - An array of file objects with the following keys:
|
155
155
|
* `content`: The file contents, this will be encoded into a base64 string internally
|
156
|
+
* `encoded_content` (optional): File content already encoded into base64 string. Overrides `content`
|
156
157
|
* `name`: The name of the file
|
157
158
|
* `type`: This is the mimetype of the file. Ex. png = image/png, pdf = application/pdf, txt = text/plain etc etc
|
158
159
|
|
159
160
|
* `:images` - An array of embedded images to add to the message:
|
160
161
|
* `content`: The file contents, this will be encoded into a base64 string internally
|
162
|
+
* `encoded_content` (optional): File content already encoded into base64 string. Overrides `content`
|
161
163
|
* `name`: The name of the file
|
162
164
|
* `type`: This is the mimetype of the file. Ex. png = image/png, pdf = application/pdf, txt = text/plain etc etc etc
|
163
165
|
|
@@ -11,7 +11,9 @@ module MandrillMailer
|
|
11
11
|
type = attachment[:mimetype] || attachment[:type]
|
12
12
|
name = attachment[:filename] || attachment[:name]
|
13
13
|
file = attachment[:file] || attachment[:content]
|
14
|
-
|
14
|
+
encoded_file = attachment[:encoded_file] || attachment[:encoded_content]
|
15
|
+
next {"type" => type, "name" => name, "content" => encoded_file} if encoded_file
|
16
|
+
next {"type" => type, "name" => name, "content" => Base64.encode64(file)}
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
data/spec/arg_formatter_spec.rb
CHANGED
@@ -10,6 +10,13 @@ describe MandrillMailer::ArgFormatter do
|
|
10
10
|
content: "testing some test test file"
|
11
11
|
}
|
12
12
|
end
|
13
|
+
let(:encoded_api_args) do
|
14
|
+
{
|
15
|
+
type: "some/type",
|
16
|
+
name: 'test',
|
17
|
+
encoded_content: Base64.encode64("testing some test test file")
|
18
|
+
}
|
19
|
+
end
|
13
20
|
|
14
21
|
let(:file_args) do
|
15
22
|
{
|
@@ -18,6 +25,13 @@ describe MandrillMailer::ArgFormatter do
|
|
18
25
|
file: "testing some test test file"
|
19
26
|
}
|
20
27
|
end
|
28
|
+
let(:encoded_file_args) do
|
29
|
+
{
|
30
|
+
mimetype: "some/type",
|
31
|
+
filename: 'test',
|
32
|
+
encoded_file: Base64.encode64("testing some test test file")
|
33
|
+
}
|
34
|
+
end
|
21
35
|
|
22
36
|
|
23
37
|
describe 'attachment_args' do
|
@@ -35,6 +49,16 @@ describe MandrillMailer::ArgFormatter do
|
|
35
49
|
'content' => Base64.encode64("testing some test test file")
|
36
50
|
}])
|
37
51
|
end
|
52
|
+
|
53
|
+
describe "passing an encoded string" do
|
54
|
+
it "formats the correct attachment data" do
|
55
|
+
expect(formatter.attachment_args([encoded_file_args])).to eq([{
|
56
|
+
'type' => "some/type",
|
57
|
+
'name' => 'test',
|
58
|
+
'content' => Base64.encode64("testing some test test file")
|
59
|
+
}])
|
60
|
+
end
|
61
|
+
end
|
38
62
|
end
|
39
63
|
|
40
64
|
context "with api syntax" do
|
@@ -45,6 +69,16 @@ describe MandrillMailer::ArgFormatter do
|
|
45
69
|
'content' => Base64.encode64("testing some test test file")
|
46
70
|
}])
|
47
71
|
end
|
72
|
+
|
73
|
+
describe "passing an encoded string" do
|
74
|
+
it "formats the correct attachment data" do
|
75
|
+
expect(formatter.attachment_args([encoded_api_args])).to eq([{
|
76
|
+
'type' => "some/type",
|
77
|
+
'name' => 'test',
|
78
|
+
'content' => Base64.encode64("testing some test test file")
|
79
|
+
}])
|
80
|
+
end
|
81
|
+
end
|
48
82
|
end
|
49
83
|
end
|
50
84
|
|
@@ -233,4 +267,4 @@ describe MandrillMailer::ArgFormatter do
|
|
233
267
|
end
|
234
268
|
end
|
235
269
|
end
|
236
|
-
end
|
270
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Rensel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|