freya 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/freya.rb +4 -9
- data/lib/freya/version.rb +1 -1
- data/spec/freya_spec.rb +2 -2
- 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: 0fc9ef92126d653689016e27f7a14ad46506e9ea
|
4
|
+
data.tar.gz: 305a808c52b256a5057bb4a70e3b893dd49512a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63ef481e57a9ab327484bb5eb0fe363f3738c2d1c8429d9eefe1ba2bc83bbfb90c74b3a2b938121a6f8290f12cb0f52ba10a283d4be0ca220f9a44753ca91ea4
|
7
|
+
data.tar.gz: dd71c683cba499f6c26628194c81fc2e36f4dc0f07ac10468abdfc535f86516a48c4baa1166bc349a613e121eef98af58f52622d1cfbae501de62eb7b693fc3e
|
data/lib/freya.rb
CHANGED
@@ -2,6 +2,7 @@ require 'freya/version'
|
|
2
2
|
require 'active_support/core_ext/hash'
|
3
3
|
require 'yaml'
|
4
4
|
require 'rails'
|
5
|
+
require 'uri/mailto'
|
5
6
|
|
6
7
|
module Freya
|
7
8
|
class Template
|
@@ -25,15 +26,9 @@ module Freya
|
|
25
26
|
|
26
27
|
class Email < OpenStruct
|
27
28
|
def link
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
param = send(param_name)
|
32
|
-
link_params << param.to_query(param_name).gsub('+', '%20') if param
|
33
|
-
link_params
|
34
|
-
end
|
35
|
-
|
36
|
-
link + link_params.join("&")
|
29
|
+
URI::MailTo.build({ to: to, headers: [
|
30
|
+
['subject', URI.escape(subject)], ['body', URI.escape(body)], *cc.map { |email| ['cc', email] }
|
31
|
+
] }).to_s
|
37
32
|
end
|
38
33
|
|
39
34
|
def body
|
data/lib/freya/version.rb
CHANGED
data/spec/freya_spec.rb
CHANGED
@@ -20,8 +20,8 @@ describe Freya::Email do
|
|
20
20
|
|
21
21
|
describe '#link' do
|
22
22
|
it 'builds a mail link with options like to, cc and the email body' do
|
23
|
-
Freya::Email.new(name: 'test_email', subject: 'subject', to: 'test@test.com', cc: ['test2@test.com']).link.should eq(
|
24
|
-
'test@test.com?subject=subject&
|
23
|
+
Freya::Email.new(name: 'test_email', subject: 'subject', to: 'test@test.com', cc: ['test1@test.com', 'test2@test.com']).link.should eq(
|
24
|
+
'mailto:test@test.com?subject=subject&body=This%20is%20the%20test%20email&cc=test1@test.com&cc=test2@test.com'
|
25
25
|
)
|
26
26
|
end
|
27
27
|
end
|