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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fa72606b6e77402bfd9832e65298688b4dfd34b
4
- data.tar.gz: 57edcc147640ec4e0912f7ac4b59ec9434d20bf0
3
+ metadata.gz: 5394e6bb558b2c4ed6dcc733dabeddf7d6a03fbe
4
+ data.tar.gz: 8eb5a40c6abfae10f051465cfecab3924c2898a0
5
5
  SHA512:
6
- metadata.gz: c3fd1ef9e49f420b4a0d443a0376cebc7fa86cb7c63fb011f14ed03e628000e7b8204e2195b0d9725f44790b97a4a38924deb6f8cbfccbb113da51b28900ccd8
7
- data.tar.gz: bbc350a8bb1c75e0787585844bf0eb71b302881bdd684cf32a518f42ae74d477a7135ec2b72aa426e4b5e925aa9d8238418c36d8341705513a71de233bda8de8
6
+ metadata.gz: 2ecb6653f391fe6e62f9602a02ba0a913f804cace4b767154c126a740f93b50ef983b69c7c1fea6fc791c525db3c85f9e01db554fcf5635737354d67c407aa7e
7
+ data.tar.gz: 72edc3556b6a151d9556f906dbbef36ea0ed16b4e3b6d9ee2ad1f6dced4f9cc61294b88fd7751b42f4de3f33e3387fc65747b02960dda4e751e860fd88306244
@@ -6,4 +6,5 @@ rvm:
6
6
  - 2.0
7
7
  - 2.1
8
8
  - 2.2
9
+ - jruby
9
10
  before_install: gem update bundler
@@ -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
@@ -4,4 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem "guard-rspec"
7
- gem "pry-plusplus"
7
+ gem "pry-plusplus", platform: :mri_20
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
- * making a real config object
114
+ * multipart emails
115
+ * attachments
@@ -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
- [:to, :subject, :from].each do |field|
48
- options[field] = send(options[field]) if options[field].is_a? Symbol
49
- end
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, :subject, :from].each do |field|
52
- options[field] ||= self.class.mailer.send(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
@@ -1,5 +1,5 @@
1
1
  module Cell
2
2
  module Mailer
3
- VERSION = "0.4.1"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
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.1
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-09 00:00:00.000000000 Z
11
+ date: 2015-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cells