cells-mailer 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +3 -1
- data/lib/cell/mailer.rb +12 -9
- data/lib/cell/mailer/configuration.rb +1 -3
- data/lib/cell/mailer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5394e6bb558b2c4ed6dcc733dabeddf7d6a03fbe
|
4
|
+
data.tar.gz: 8eb5a40c6abfae10f051465cfecab3924c2898a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ecb6653f391fe6e62f9602a02ba0a913f804cace4b767154c126a740f93b50ef983b69c7c1fea6fc791c525db3c85f9e01db554fcf5635737354d67c407aa7e
|
7
|
+
data.tar.gz: 72edc3556b6a151d9556f906dbbef36ea0ed16b4e3b6d9ee2ad1f6dced4f9cc61294b88fd7751b42f4de3f33e3387fc65747b02960dda4e751e860fd88306244
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.5.0 [☰](https://github.com/timoschilling/cells-mailer/compare/v0.4.1...v0.5.0)
|
4
|
+
|
5
|
+
* support for setting one format (still no multiformat support yet)
|
6
|
+
* fix a bug with fields via instance methods
|
7
|
+
|
3
8
|
## v0.4.1 [☰](https://github.com/timoschilling/cells-mailer/compare/v0.4.0...v0.4.1)
|
4
9
|
|
5
10
|
* fix a bug with `delivery_method` handling
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -100,6 +100,7 @@ class UserNotificationCell < Cell::ViewModel
|
|
100
100
|
from "nick@trailblazer.to"
|
101
101
|
subject "nick loves good code!"
|
102
102
|
mail_options delivery_method: :smtp
|
103
|
+
format :html # or :text
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
@@ -110,4 +111,5 @@ This configurations will be inherited.
|
|
110
111
|
|
111
112
|
## Roadmap
|
112
113
|
|
113
|
-
*
|
114
|
+
* multipart emails
|
115
|
+
* attachments
|
data/lib/cell/mailer.rb
CHANGED
@@ -35,21 +35,17 @@ module Cell
|
|
35
35
|
mail
|
36
36
|
end
|
37
37
|
|
38
|
-
def mail_delivery_method
|
39
|
-
self.class.mailer.mail_options[:delivery_method]
|
40
|
-
end
|
41
|
-
|
42
38
|
def process_mail_options(options)
|
43
39
|
if options[:body] && options[:method]
|
44
40
|
raise ArgumentError, "You can't pass in `:method` and `:body` at once!"
|
45
41
|
end
|
46
42
|
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
# TODO: this should handel by Configuration
|
44
|
+
options = self.class.mailer.store.delete_if{ |_, v| v == nil }.merge options
|
45
|
+
options = Cell::Mailer.configuration.store.delete_if{ |_, v| v == nil }.merge options
|
50
46
|
|
51
|
-
[:to, :
|
52
|
-
options[field]
|
47
|
+
[:to, :from, :subject].each do |field|
|
48
|
+
options[field] = send(options[field]) if options[field].is_a? Symbol
|
53
49
|
end
|
54
50
|
|
55
51
|
self.class.mailer.mail_options.each do |key, value|
|
@@ -59,6 +55,13 @@ module Cell
|
|
59
55
|
state = options.delete(:method) || :show
|
60
56
|
options[:body] ||= call(state)
|
61
57
|
|
58
|
+
options[:content_type] = case options.delete(:format) || :text
|
59
|
+
when :html
|
60
|
+
"text/html"
|
61
|
+
when :text
|
62
|
+
"text/plain"
|
63
|
+
end
|
64
|
+
|
62
65
|
[options, options.delete(:delivery_method)]
|
63
66
|
end
|
64
67
|
|
@@ -3,7 +3,7 @@ module Cell
|
|
3
3
|
class Configuration
|
4
4
|
class << self
|
5
5
|
def attributes
|
6
|
-
{ to: nil, from: nil, subject: nil, mail_options: {} }
|
6
|
+
{ to: nil, from: nil, subject: nil, format: nil, mail_options: {} }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -37,8 +37,6 @@ module Cell
|
|
37
37
|
self.class.new cloned_store
|
38
38
|
end
|
39
39
|
|
40
|
-
private
|
41
|
-
|
42
40
|
attr_reader :store
|
43
41
|
end
|
44
42
|
end
|
data/lib/cell/mailer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Schilling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cells
|