cells-mailer 0.4.0 → 0.4.1

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: 83f7e7d1776d36365534b7d138b15fa29de2ddeb
4
- data.tar.gz: 5c2a36aba0182cf3f70ca97cd914e2e2e0d319aa
3
+ metadata.gz: 1fa72606b6e77402bfd9832e65298688b4dfd34b
4
+ data.tar.gz: 57edcc147640ec4e0912f7ac4b59ec9434d20bf0
5
5
  SHA512:
6
- metadata.gz: 1295b6794f28f77da5e842e403b20295f910e1f3175b9d90025bc859c4ab5e8a7f50d1faa8cf422285c5fac4e946169b5c10d2efc95856c3ba28970a71a3445b
7
- data.tar.gz: 7a16e2ad3076e5d8896b8948e0dd5963da9ed0a8a1a29d418ff4ec99310f89845a0127a3da37c1e55a5a0ae9c9816ada6ea9c18c616982af8174f9aa74b621e8
6
+ metadata.gz: c3fd1ef9e49f420b4a0d443a0376cebc7fa86cb7c63fb011f14ed03e628000e7b8204e2195b0d9725f44790b97a4a38924deb6f8cbfccbb113da51b28900ccd8
7
+ data.tar.gz: bbc350a8bb1c75e0787585844bf0eb71b302881bdd684cf32a518f42ae74d477a7135ec2b72aa426e4b5e925aa9d8238418c36d8341705513a71de233bda8de8
data/.travis.yml CHANGED
@@ -2,5 +2,8 @@ language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
+ - 1.9
6
+ - 2.0
7
+ - 2.1
5
8
  - 2.2
6
9
  before_install: gem update bundler
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.4.1 [☰](https://github.com/timoschilling/cells-mailer/compare/v0.4.0...v0.4.1)
4
+
5
+ * fix a bug with `delivery_method` handling
6
+
3
7
  ## v0.4.0 [☰](https://github.com/timoschilling/cells-mailer/compare/v0.3.0...v0.4.0)
4
8
 
5
9
  * global configuration
data/Gemfile CHANGED
@@ -4,4 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem "guard-rspec"
7
- gem "pry"
7
+ gem "pry-plusplus"
data/bin/console CHANGED
@@ -7,8 +7,8 @@ require "cells-mailer"
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
10
+ require "pry"
11
+ Pry.start
12
12
 
13
- require "irb"
14
- IRB.start
13
+ # require "irb"
14
+ # IRB.start
@@ -1,5 +1,5 @@
1
1
  module Cell
2
2
  module Mailer
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
data/lib/cell/mailer.rb CHANGED
@@ -22,12 +22,23 @@ module Cell
22
22
  end
23
23
 
24
24
  def deliver(options = {})
25
- mail = Mail.new process_mail_options(options)
26
- mail.deliver
25
+ build_mail(options).deliver
27
26
  end
28
27
 
29
28
  private
30
29
 
30
+ def build_mail(options)
31
+ options, delivery_method = process_mail_options(options)
32
+
33
+ mail = Mail.new options
34
+ mail.delivery_method *delivery_method
35
+ mail
36
+ end
37
+
38
+ def mail_delivery_method
39
+ self.class.mailer.mail_options[:delivery_method]
40
+ end
41
+
31
42
  def process_mail_options(options)
32
43
  if options[:body] && options[:method]
33
44
  raise ArgumentError, "You can't pass in `:method` and `:body` at once!"
@@ -41,14 +52,14 @@ module Cell
41
52
  options[field] ||= self.class.mailer.send(field)
42
53
  end
43
54
 
44
- (self.class.mailer.mail_options || {}).each do |key, value|
55
+ self.class.mailer.mail_options.each do |key, value|
45
56
  options[key] = value
46
57
  end
47
58
 
48
59
  state = options.delete(:method) || :show
49
60
  options[:body] ||= call(state)
50
61
 
51
- options
62
+ [options, options.delete(:delivery_method)]
52
63
  end
53
64
 
54
65
  module ClassMethods
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.0
4
+ version: 0.4.1
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-08 00:00:00.000000000 Z
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cells