Class: Ish::EmailContext
- Inherits:
-
Object
- Object
- Ish::EmailContext
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/ish/email_context.rb
Overview
Send a single email
Constant Summary collapse
- PAGE_PARAM_NAME =
'email_contexts_page'
Instance Attribute Summary collapse
-
#tid ⇒ Object
readonly
For tracking / utm.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #get_binding ⇒ Object
- #lead ⇒ Object
- #notsent ⇒ Object
- #preview_str ⇒ Object
- #sch ⇒ Object
- #scheduled ⇒ Object
- #tmpl ⇒ Object
-
#to_email ⇒ Object
@TODO: remove, just use the lead.
Instance Attribute Details
#tid ⇒ Object (readonly)
For tracking / utm
77 78 79 |
# File 'lib/ish/email_context.rb', line 77 def tid @tid end |
Class Method Details
.from_email_list ⇒ Object
65 66 67 |
# File 'lib/ish/email_context.rb', line 65 def self.from_email_list Ish::EmailCampaign.from_email_list end |
.notsent ⇒ Object
55 |
# File 'lib/ish/email_context.rb', line 55 def self.notsent; new.notsent; end |
.scheduled ⇒ Object
62 |
# File 'lib/ish/email_context.rb', line 62 def self.scheduled; new.scheduled; end |
Instance Method Details
#body ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ish/email_context.rb', line 22 def body if self[:body].presence return self[:body] else return tmpl.body end end |
#get_binding ⇒ Object
79 80 81 82 |
# File 'lib/ish/email_context.rb', line 79 def get_binding @lead = lead() binding() end |
#lead ⇒ Object
70 |
# File 'lib/ish/email_context.rb', line 70 def lead; Lead.find( lead_id ); end |
#notsent ⇒ Object
52 53 54 |
# File 'lib/ish/email_context.rb', line 52 def notsent Ish::EmailContext.where( sent_at: nil ) end |
#preview_str ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ish/email_context.rb', line 13 def preview_str if self[:preview_str].presence return self[:preview_str] else return tmpl.preview_str end end |
#sch ⇒ Object
44 |
# File 'lib/ish/email_context.rb', line 44 def sch; scheduled_email_action; end |
#scheduled ⇒ Object
58 59 60 61 |
# File 'lib/ish/email_context.rb', line 58 def scheduled # or({ :send_at.lte => Time.now }, { :send_at => nil }) ## This won't work b/c I need draft state! Ish::EmailContext.where({ :send_at.lte => Time.now }) end |
#tmpl ⇒ Object
41 |
# File 'lib/ish/email_context.rb', line 41 def tmpl; email_template; end |
#to_email ⇒ Object
@TODO: remove, just use the lead. vp 2023-03-27
71 |
# File 'lib/ish/email_context.rb', line 71 def to_email; lead[:email]; end |