no_notifier_needed 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -1,8 +1,8 @@
1
1
  require 'no_notifier_needed/send'
2
2
  require 'no_notifier_needed/translate'
3
3
  require 'no_notifier_needed/render'
4
- require 'no_notifier_needed/config'
5
4
  require 'no_notifier_needed/sender'
5
+ require 'no_notifier_needed/config'
6
6
 
7
7
  module NoNotifierNeeded
8
8
  extend Config
@@ -2,7 +2,8 @@ module NoNotifierNeeded
2
2
  module Config
3
3
 
4
4
  VALID_OPTIONS_KEYS = [
5
- :from,
5
+ :from_email,
6
+ :from_name,
6
7
  :bcc,
7
8
  :reply_to,
8
9
  :host,
@@ -0,0 +1,18 @@
1
+ module NoNotifierNeeded
2
+ module Sender
3
+ def mcp(email_name, args)
4
+ @template = EmailTemplate.find_by_name(email_name)
5
+ raise "Email Template name not found" if @template.nil?
6
+
7
+ args_to_instance_vars(args)
8
+
9
+ debugger
10
+ mail_is = mail(get_send_hash) do|format|
11
+ format.html { render :inline => render_template_body_type(@template) }
12
+ end
13
+
14
+ return mail_is
15
+ end
16
+ end
17
+ end
18
+
@@ -20,8 +20,8 @@ module NoNotifierNeeded
20
20
  "<a href='#{root_link}'>#{title}</a>"
21
21
  end
22
22
 
23
- def get_send_hash
24
- send_hash = base_send_hash
23
+ def get_send_hash(template)
24
+ send_hash = base_send_hash(template)
25
25
  send_hash[:subject] = render_template_subject_type(@template)
26
26
  send_hash[:to] = @to.nil? ? @user.email : @to
27
27
  send_hash[:from] = @from unless @from.nil?
@@ -34,6 +34,9 @@ module NoNotifierNeeded
34
34
  NoNotifierNeeded::Config::VALID_OPTIONS_KEYS.each do |k|
35
35
  base[k] = NoNotifierNeeded.send(k)
36
36
  end
37
+ base[:from] = "#{base.delete(:from_name)} <#{base.delete(:from_email)}>"
38
+ base[:from] = "#{template.from_name} <#{template.from_email}>" if template.from_name && template.from_email
39
+ base[:reply_to] = "#{template.reply_to}" if template.reply_to
37
40
  base
38
41
  end
39
42
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "no_notifier_needed"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robert R. Meyer"]
12
- s.date = "2013-01-14"
12
+ s.date = "2013-01-15"
13
13
  s.description = "A work in progress"
14
14
  s.email = "Blue.Dog.Archolite@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/no_notifier_needed/railtie.rb",
33
33
  "lib/no_notifier_needed/render.rb",
34
34
  "lib/no_notifier_needed/send.rb",
35
+ "lib/no_notifier_needed/sender.rb",
35
36
  "lib/no_notifier_needed/translate.rb",
36
37
  "no_notifier_needed.gemspec",
37
38
  "test/helper.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no_notifier_needed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -146,6 +146,7 @@ files:
146
146
  - lib/no_notifier_needed/railtie.rb
147
147
  - lib/no_notifier_needed/render.rb
148
148
  - lib/no_notifier_needed/send.rb
149
+ - lib/no_notifier_needed/sender.rb
149
150
  - lib/no_notifier_needed/translate.rb
150
151
  - no_notifier_needed.gemspec
151
152
  - test/helper.rb
@@ -165,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
166
  version: '0'
166
167
  segments:
167
168
  - 0
168
- hash: 4043883822035756603
169
+ hash: -3954367051618848728
169
170
  required_rubygems_version: !ruby/object:Gem::Requirement
170
171
  none: false
171
172
  requirements: