freya 0.0.4 → 0.0.5

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: 21e31ab534884c80678d4a173a9a5286dfb90752
4
- data.tar.gz: 66310b314fa61c8de0ec5adc55513b2446dcf5d8
3
+ metadata.gz: 0fc9ef92126d653689016e27f7a14ad46506e9ea
4
+ data.tar.gz: 305a808c52b256a5057bb4a70e3b893dd49512a4
5
5
  SHA512:
6
- metadata.gz: aea7175c75d44841c900a6106fb4062469750ee6732455d0d9310dd8ad1d4dc0315da44049cd15493823b78097c9e3d120b4496eb2d308abc9fa44c43923ab4f
7
- data.tar.gz: e8419e2371c433917c0bf0818ccb6c6a9dcfe899ea67e54263f76b20f36aa9ba5fc1afe03874820303464e03ef6b01170c5e4aa629d70b6192a9fa0898c5125f
6
+ metadata.gz: 63ef481e57a9ab327484bb5eb0fe363f3738c2d1c8429d9eefe1ba2bc83bbfb90c74b3a2b938121a6f8290f12cb0f52ba10a283d4be0ca220f9a44753ca91ea4
7
+ data.tar.gz: dd71c683cba499f6c26628194c81fc2e36f4dc0f07ac10468abdfc535f86516a48c4baa1166bc349a613e121eef98af58f52622d1cfbae501de62eb7b693fc3e
@@ -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
- link = to + '?'
29
-
30
- link_params = ['subject', 'cc', 'body'].inject([]) do |link_params, param_name|
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
@@ -1,3 +1,3 @@
1
1
  module Freya
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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&cc%5B%5D=test2%40test.com&body=This%20is%20the%20test%20email'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Depalo