Class: Ish::EmailContext
- Inherits:
-
Object
- Object
- Ish::EmailContext
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/ish/email_context.rb
Overview
Sends a single email
Constant Summary collapse
- PAGE_PARAM_NAME =
'email_contexts_page'
- FROM_EMAILS =
[ 'Infinite Shelter <[email protected]>', 'Infinite Shelter <[email protected]>', 'Victor Piousbox <[email protected]>', 'Victor Piousbox <[email protected]>', 'Victor Piousbox <[email protected]>', 'Victor Piousbox <[email protected]>', 'WasyaCo Consulting <[email protected]>', 'WasyaCo Consulting <[email protected]>', 'Victor Piousbox <[email protected]>', ]
Instance Attribute Summary collapse
-
#tid ⇒ Object
readonly
For tracking / utm.
Class Method Summary collapse
Instance Method Summary collapse
- #get_binding ⇒ Object
- #lead ⇒ Object
- #preview_str ⇒ Object
- #scheduled ⇒ Object
-
#slug ⇒ Object
@TODO: probably rename it to slug.
- #tmpl ⇒ Object
-
#to_email ⇒ Object
@deprecated: use self.lead.
- #unsent ⇒ Object
Instance Attribute Details
#tid ⇒ Object (readonly)
For tracking / utm
94 95 96 |
# File 'lib/ish/email_context.rb', line 94 def tid @tid end |
Class Method Details
.from_email_list ⇒ Object
38 39 40 |
# File 'lib/ish/email_context.rb', line 38 def self.from_email_list [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] } end |
.scheduled ⇒ Object
67 68 69 |
# File 'lib/ish/email_context.rb', line 67 def self.scheduled new.scheduled end |
.unsent ⇒ Object
60 61 62 |
# File 'lib/ish/email_context.rb', line 60 def self.unsent new.unsent end |
Instance Method Details
#get_binding ⇒ Object
96 97 98 99 |
# File 'lib/ish/email_context.rb', line 96 def get_binding @lead = lead() binding() end |
#lead ⇒ Object
77 78 79 |
# File 'lib/ish/email_context.rb', line 77 def lead Lead.find lead_id end |
#preview_str ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ish/email_context.rb', line 15 def preview_str if self[:preview_str].presence? return self[:preview_str] else return tmpl.preview_str end end |
#scheduled ⇒ Object
70 71 72 73 |
# File 'lib/ish/email_context.rb', line 70 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 |
#slug ⇒ Object
@TODO: probably rename it to slug
11 |
# File 'lib/ish/email_context.rb', line 11 field :slug |
#tmpl ⇒ Object
48 49 50 |
# File 'lib/ish/email_context.rb', line 48 def tmpl email_template end |
#to_email ⇒ Object
@deprecated: use self.lead
81 |
# File 'lib/ish/email_context.rb', line 81 field :to_email |
#unsent ⇒ Object
63 64 65 |
# File 'lib/ish/email_context.rb', line 63 def unsent Ish::EmailContext.where( sent_at: nil ) end |