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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01b0762b4aecc2dab14ff7cd85a99f5983185a528429b80a34daf75b53003b01
4
- data.tar.gz: 00ceedf63ed4a2a18b0ef2f6571ad7338e9ab6154b41f870cf61a3caf4d58dcc
3
+ metadata.gz: 2df464fe5809a855caf4522381a27fb4513aafbe1d25541d40e094af74d22b54
4
+ data.tar.gz: 3d6f55250c61a5c6997635543330166fad5f01427cf769b9736c5aba196edc04
5
5
  SHA512:
6
- metadata.gz: b0b6fe51bf7aca4604c7fcc8bdce55c4ae88530015fb34638fe7f97f5ef50321b059d36c1101b6405a37513ba32db346e8984532495ba152382b178c561824a2
7
- data.tar.gz: 9f7ea030c5a857720d3f01548d5174c8d172914b4223396c9bbe50704ca8db4cb523ff7b0a070b12658c51065ca8e6dc5b963fd30e1418dcebcefdfbf8394cbb
6
+ metadata.gz: b95a304e86c9285ce73702cef85911a3664d4e51399b248ced6fa3db1e6e7ccaa214253e3970393aeeb327b55b690195774655a0797c3e900c6a4df53e71d639
7
+ data.tar.gz: 4ab881435c6a00604afb16fb1aeeb6a8b3244049c094ab144576bbf2a2be2bf8c39d098f657a300d06153049416439cd284eb2a71ceaeaf69aed2b5dad22d4e1
@@ -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
- check_delivery_params(mail) if respond_to?(:check_delivery_params)
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:///#{URI.parse(CGI.escape(messages.first.filepath))}")
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.5.0
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-02 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy