freya 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/freya.rb +13 -5
- data/lib/freya/version.rb +1 -1
- data/spec/freya_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c20cb87d4dc89671f64c5d80b08cf92cc777c8d7
|
4
|
+
data.tar.gz: 2506895aa7760277dcb486689d611f327f02dba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4264622b00d019bbac7e21e3d13d57dee027d5013313f90a4402d18ade324853ca0858ee9e3961f101f0cb030cac7bdd88cf9d6bd46fb2d0123f5542abce7b15
|
7
|
+
data.tar.gz: 8409d899a05477de3e8381b94e05c3d92d8c3c986539f35ee229555a3e1d38df851eeb48538d799d418ee8066acbb32fcde2e25cc7408554adc42383aebdd723
|
data/lib/freya.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'freya/version'
|
2
|
-
require 'active_support/core_ext
|
2
|
+
require 'active_support/core_ext'
|
3
3
|
require 'yaml'
|
4
4
|
require 'rails'
|
5
|
-
require 'uri/mailto'
|
6
5
|
|
7
6
|
module Freya
|
8
7
|
class Template
|
@@ -26,9 +25,18 @@ module Freya
|
|
26
25
|
|
27
26
|
class Email < OpenStruct
|
28
27
|
def link
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
extras = %w{ cc bcc body subject }.select { |extra| send(extra).present? }.map { |extra| [extra, send(extra)] }.map { |extra|
|
29
|
+
name = extra[0]
|
30
|
+
value = extra[1]
|
31
|
+
|
32
|
+
[value].flatten.map do |component|
|
33
|
+
"#{name}=#{Rack::Utils.escape_path(component)}"
|
34
|
+
end
|
35
|
+
}.compact
|
36
|
+
|
37
|
+
extras = extras.empty? ? '' : '?' + extras.join('&')
|
38
|
+
|
39
|
+
"#{to}#{extras}"
|
32
40
|
end
|
33
41
|
|
34
42
|
def body
|
data/lib/freya/version.rb
CHANGED
data/spec/freya_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe Freya::Email do
|
|
21
21
|
describe '#link' do
|
22
22
|
it 'builds a mail link with options like to, cc and the email body' do
|
23
23
|
Freya::Email.new(name: 'test_email', subject: 'subject', to: 'test@test.com', cc: ['test1@test.com', 'test2@test.com']).link.should eq(
|
24
|
-
'test@test.com?
|
24
|
+
'test@test.com?cc=test1%40test.com&cc=test2%40test.com&body=This%20is%20the%20test%20email&subject=subject'
|
25
25
|
)
|
26
26
|
end
|
27
27
|
end
|