no_notifier_needed 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -15,5 +15,28 @@ module NoNotifierNeeded
15
15
  time_from_now = what_time.is_a?(Time) ? what_time : Chronic.parse(what_time)
16
16
  Resque.enqueue_at(time_from_now, EmailProcessor, email_hash)
17
17
  end
18
+
19
+ private
20
+ def known_models
21
+ @known_models || @known_models = ActiveRecord::Base.send( :subclasses )
22
+ end
23
+
24
+ def translate_to_hash(which_email, args)
25
+ th = {}
26
+ th[:which_email] = which_email
27
+
28
+ args = args.flatten if args.respond_to?(:flatten)
29
+ args.each do |a|
30
+ next if a.blank?
31
+ if known_models.include?(a.class)
32
+ th[a.class.name.downcase.to_sym] = a.id
33
+ elsif a.is_a?(Hash)
34
+ a.each{|k,v| th[k.to_sym] = CGI.escapeHTML(v) }
35
+ else
36
+ raise ArgumentError.new("Unknown values passed to email procesor '#{a}' with #{args.inspect}")
37
+ end
38
+ end
39
+ th
40
+ end
18
41
  end
19
42
  end
@@ -1,13 +1,14 @@
1
1
  module NoNotifierNeeded
2
2
  module Sender
3
3
  def mcp(email_name, args)
4
- template = EmailTemplate.find_by_name(email_name)
5
- raise "Email Template name not found" if template.nil?
4
+ @template = EmailTemplate.find_by_name(email_name)
5
+ raise "Email Template name not found" if @template.nil?
6
6
 
7
7
  args_to_instance_vars(args)
8
8
 
9
+ debugger
9
10
  mail_is = mail(get_send_hash) do|format|
10
- format.html { render :inline => render_template_body_type(template) }
11
+ format.html { render :inline => render_template_body_type(@template) }
11
12
  end
12
13
 
13
14
  return mail_is
@@ -56,23 +56,5 @@ module NoNotifierNeeded
56
56
  def known_models
57
57
  @known_models || @known_models = ActiveRecord::Base.send( :subclasses )
58
58
  end
59
-
60
- def translate_to_hash(which_email, args)
61
- th = {}
62
- th[:which_email] = which_email
63
-
64
- args = args.flatten if args.respond_to?(:flatten)
65
- args.each do |a|
66
- next if a.blank?
67
- if known_models.include?(a.class)
68
- th[a.class.name.downcase.to_sym] = a.id
69
- elsif a.is_a?(Hash)
70
- a.each{|k,v| th[k.to_sym] = CGI.escapeHTML(v) }
71
- else
72
- raise ArgumentError.new("Unknown values passed to email procesor '#{a}' with #{args.inspect}")
73
- end
74
- end
75
- th
76
- end
77
59
  end
78
60
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "no_notifier_needed"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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"]
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.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  segments:
168
168
  - 0
169
- hash: 2782706298375828992
169
+ hash: 2488185808821733751
170
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements: