letter_opener 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 +4 -0
- data/lib/letter_opener/delivery_method.rb +14 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df464fe5809a855caf4522381a27fb4513aafbe1d25541d40e094af74d22b54
|
4
|
+
data.tar.gz: 3d6f55250c61a5c6997635543330166fad5f01427cf769b9736c5aba196edc04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95a304e86c9285ce73702cef85911a3664d4e51399b248ced6fa3db1e6e7ccaa214253e3970393aeeb327b55b690195774655a0797c3e900c6a4df53e71d639
|
7
|
+
data.tar.gz: 4ab881435c6a00604afb16fb1aeeb6a8b3244049c094ab144576bbf2a2be2bf8c39d098f657a300d06153049416439cd284eb2a71ceaeaf69aed2b5dad22d4e1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.6.0 ##
|
2
|
+
* Do not depend on Mail gem to check delivery params.
|
3
|
+
* Do not parse and escape url before passing it to Launchy.
|
4
|
+
|
1
5
|
## 1.5.0 ##
|
2
6
|
* Use proper check for `Rails::Railties` (thanks [Florian Weingarten](https://github.com/fw42))
|
3
7
|
* Add a shim for the iFrame "srcdoc" attribute (make it work with IE).
|
@@ -1,15 +1,8 @@
|
|
1
1
|
require "digest/sha1"
|
2
2
|
require "launchy"
|
3
|
-
begin
|
4
|
-
require "mail"
|
5
|
-
require "mail/check_delivery_params"
|
6
|
-
rescue LoadError
|
7
|
-
end
|
8
3
|
|
9
4
|
module LetterOpener
|
10
5
|
class DeliveryMethod
|
11
|
-
include Mail::CheckDeliveryParams if defined?(Mail::CheckDeliveryParams)
|
12
|
-
|
13
6
|
class InvalidOption < StandardError; end
|
14
7
|
|
15
8
|
attr_accessor :settings
|
@@ -24,11 +17,23 @@ module LetterOpener
|
|
24
17
|
end
|
25
18
|
|
26
19
|
def deliver!(mail)
|
27
|
-
|
20
|
+
validate_mail!(mail)
|
28
21
|
location = File.join(settings[:location], "#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
|
29
22
|
|
30
23
|
messages = Message.rendered_messages(mail, location: location, message_template: settings[:message_template])
|
31
|
-
Launchy.open("file:///#{
|
24
|
+
Launchy.open("file:///#{messages.first.filepath}")
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def validate_mail!(mail)
|
30
|
+
if !mail.from || mail.from.empty?
|
31
|
+
raise ArgumentError, "SMTP From address may not be blank"
|
32
|
+
end
|
33
|
+
|
34
|
+
if !mail.to || mail.to.empty?
|
35
|
+
raise ArgumentError, "SMTP To address may not be blank"
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: letter_opener
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|