pony 1.7 → 1.8

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: ce1e07719a6d6f72a10ac2ae08217d85fb3aa5f4
4
- data.tar.gz: 9d8e1332919f03c78ab439e2b22b894b3afcc3a3
3
+ metadata.gz: 306baec4e44b3d4c866118d06d7b6fe47644f1b0
4
+ data.tar.gz: e7aa58fb5549b1ffc88e5949e035a4f43dbb206f
5
5
  SHA512:
6
- metadata.gz: 1343e76f77aa91409afbd022495de50580b376fee2e0954bc98b197f787043e58642ed3b216c1b08d9efd3d1e3af2d32ffe85513bc30a95da18b1780e84a7810
7
- data.tar.gz: f867a5b22fbbfc411ae524e5020ae09d749f92b14aaeadec1365199891e6bcbcc6b8319814dd5b58dc103e70cef1202efa050831b4cd49cc477c1905e8bae476
6
+ metadata.gz: cba682e447d4636d7b01e6ad25ea1218fc01ec0365051e7690c6572471dddcfaf6337243a0e6afcfb48022993dc95db89d7d6e38c4dc021ff20c26c2c657b98b
7
+ data.tar.gz: 8e2914fcfd9066c24f520dac70d5ac9ea4b3b7c5a0e2bebdf6e876d577aee41c1ee2bf9eb5cdcfd15c43245415130dd8839d02cd385e4228eb1b90bdd362d97d
@@ -81,6 +81,20 @@ Pony allows you to specify custom mail headers
81
81
  :headers => { "List-ID" => "...", "X-My-Custom-Header" => "what a cool custom header" }
82
82
  )
83
83
 
84
+ Add additional options for headers in each part of letter (text, html)
85
+ Pony.mail(
86
+ :body => 'test',
87
+ :html_body => 'What do you know, Joe?',
88
+ :attachments => {"foo.txt" => "content of foo.txt"},
89
+ :body_part_header => { content_disposition: "inline" }
90
+ )
91
+
92
+ This will add option 'Content-Disposition: inline' for text part header of letter.
93
+
94
+ Also you can add additional options for html part of latter, e.g.:
95
+ :html_body_part_header => { content_disposition: "inline" }
96
+
97
+
84
98
  == List Of Options
85
99
 
86
100
  Options passed pretty much directly to Mail
@@ -96,6 +110,8 @@ Options passed pretty much directly to Mail
96
110
  text_part_charset # for multipart messages, set the charset of the text part
97
111
  attachments # see Attachments section above
98
112
  headers # see Custom headers section above
113
+ body_part_header # see Custom headers section above
114
+ html_body_part_header # see Custom headers section above
99
115
  message_id
100
116
  sender # Sets "envelope from" (and the Sender header)
101
117
  reply_to
@@ -152,6 +168,9 @@ mailing list: ponyrb@googlegroups.com
152
168
 
153
169
 
154
170
  == Releases
171
+ 1.8
172
+ * Add additional options for headers in each part of letter
173
+
155
174
  1.7
156
175
  * Better default content_type with attachments
157
176
 
@@ -163,6 +163,8 @@ module Pony
163
163
  :text_part_charset,
164
164
  :via,
165
165
  :via_options,
166
+ :body_part_header,
167
+ :html_body_part_header
166
168
  ]
167
169
 
168
170
  options.each do |k, v|
@@ -174,6 +176,11 @@ module Pony
174
176
  html_part do
175
177
  content_type 'text/html; charset=UTF-8'
176
178
  body options[:html_body]
179
+ if options[:html_body_part_header] && options[:html_body_part_header].is_a?(Hash)
180
+ options[:html_body_part_header].each do |k,v|
181
+ header[k] = v
182
+ end
183
+ end
177
184
  end
178
185
  end
179
186
 
@@ -182,6 +189,11 @@ module Pony
182
189
  if options[:body] && (options[:html_body] || options[:attachments])
183
190
  text_part do
184
191
  body options[:body]
192
+ if options[:body_part_header] && options[:body_part_header].is_a?(Hash)
193
+ options[:body_part_header].each do |k,v|
194
+ header[k] = v
195
+ end
196
+ end
185
197
  end
186
198
  elsif options[:body]
187
199
  body options[:body]
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'pony'
5
- s.version = "1.7"
5
+ s.version = "1.8"
6
6
 
7
7
  s.summary = "Send email in one command: Pony.mail(:to => 'someone@example.com', :body => 'hello')"
8
8
  s.description = s.summary
@@ -243,4 +243,32 @@ describe Pony do
243
243
  end
244
244
  end
245
245
 
246
+ describe "additional headers" do
247
+ subject(:mail) do
248
+ Pony.build_mail(
249
+ :body => 'test',
250
+ :html_body => 'What do you know, Joe?',
251
+ :attachments => {"foo.txt" => "content of foo.txt"},
252
+ :body_part_header => { content_disposition: "inline"},
253
+ :html_body_part_header => { content_disposition: "inline"}
254
+ )
255
+ end
256
+
257
+ it { expect(mail.parts[0].to_s).to include( 'inline' ) }
258
+ it { expect(mail.parts[1].to_s).to include( 'inline' ) }
259
+
260
+ context "when parts aren't present" do
261
+ subject(:mail) do
262
+ Pony.build_mail(
263
+ :body => 'test',
264
+ :body_part_header => { content_disposition: "inline"},
265
+ :html_body_part_header => { content_disposition: "inline"}
266
+ )
267
+ end
268
+
269
+ it { expect(mail.parts).to be_empty }
270
+ it { expect(mail.to_s).to_not include( 'inline' ) }
271
+ end
272
+ end
273
+
246
274
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pony
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.7'
4
+ version: '1.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wiggins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-08 00:00:00.000000000 Z
12
+ date: 2014-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail