freya 0.3.0 → 0.3.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 +3 -14
- data/lib/freya/version.rb +1 -1
- data/spec/freya_spec.rb +14 -6
- 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: 51e3de6fb2d29a2ba54199a69e91463f57548797
|
4
|
+
data.tar.gz: 8b2150b89c632d9113996a573ae44d39b88a57d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39f04054521876c19d02c796ad7bb9a1103a3d552687e6efd145cb3dbc30f2b6439665191dffd13d4b9bccd8257697af2804957565b1793b62ff4e266f4c6370
|
7
|
+
data.tar.gz: f0240b5f61ed76907cd9219c0ec14f69ea0f68ba17c00a9483158296d6dab2c4a56bc587934c0b72563c25e4ac853b327c22444bf1c5ff98a27e360e999feba3
|
data/lib/freya.rb
CHANGED
@@ -23,18 +23,7 @@ module Freya
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
class Email
|
27
|
-
attr_accessor :name, :to, :subject, :cc, :bcc
|
28
|
-
cattr_accessor :cc, :bcc
|
29
|
-
|
30
|
-
def initialize(options = {})
|
31
|
-
@name = options[:name]
|
32
|
-
@to = options[:to]
|
33
|
-
@subject = options[:subject]
|
34
|
-
@cc = options[:cc]
|
35
|
-
@bcc = options[:bcc]
|
36
|
-
end
|
37
|
-
|
26
|
+
class Email < OpenStruct
|
38
27
|
def link
|
39
28
|
extras = %w{ cc bcc body subject }.select { |extra| send(extra).present? }.map { |extra| [extra, send(extra)] }.map { |extra|
|
40
29
|
name = extra[0]
|
@@ -56,11 +45,11 @@ module Freya
|
|
56
45
|
end
|
57
46
|
|
58
47
|
def cc
|
59
|
-
|
48
|
+
base_cc.to_a + self[:cc].to_a - [to]
|
60
49
|
end
|
61
50
|
|
62
51
|
def bcc
|
63
|
-
|
52
|
+
base_bcc.to_a + self[:bcc].to_a - [to]
|
64
53
|
end
|
65
54
|
end
|
66
55
|
end
|
data/lib/freya/version.rb
CHANGED
data/spec/freya_spec.rb
CHANGED
@@ -61,17 +61,25 @@ describe Freya::Email do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe '
|
64
|
+
describe 'base_cc' do
|
65
65
|
it 'contains the base ccs' do
|
66
|
-
Freya::Email.
|
67
|
-
|
66
|
+
Freya::Email.new(
|
67
|
+
name: 'test_email',
|
68
|
+
to: 'test@test.com',
|
69
|
+
cc: ['test@test.com','test2@test.com'],
|
70
|
+
base_cc: ['base_email@test.com']
|
71
|
+
).cc.should eq(['base_email@test.com', 'test2@test.com'])
|
68
72
|
end
|
69
73
|
end
|
70
74
|
|
71
|
-
describe '
|
75
|
+
describe 'base_bcc' do
|
72
76
|
it 'contains the base bccs' do
|
73
|
-
Freya::Email.
|
74
|
-
|
77
|
+
Freya::Email.new(
|
78
|
+
name: 'test_email',
|
79
|
+
to: 'test@test.com',
|
80
|
+
bcc: ['test@test.com','test1@test.com'],
|
81
|
+
base_bcc: ['base_email@test.com']
|
82
|
+
).bcc.should eq(['base_email@test.com', 'test1@test.com'])
|
75
83
|
end
|
76
84
|
end
|
77
85
|
end
|