Class: Office::LeadActionTemplate
- Inherits:
-
Object
- Object
- Office::LeadActionTemplate
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/office/lead_action_template.rb
Constant Summary collapse
- KIND_UNSUBSCRIBE_TEMPLATE =
'kind-unsubscribe-template'- KIND_UNSUBSCRIBE_CAMPAIGN =
'kind-unsubscribe-campaign'- KINDS =
[ KIND_UNSUBSCRIBE_TEMPLATE, KIND_UNSUBSCRIBE_CAMPAIGN ]
Instance Method Summary collapse
Instance Method Details
#unsubscribe_from_campaign ⇒ Object
24 25 |
# File 'lib/office/lead_action_template.rb', line 24 def unsubscribe_from_campaign end |
#unsubscribe_from_template ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/office/lead_action_template.rb', line 27 def unsubscribe_from_template template = EmailTemplate.find( ctx[:template_id] ) subject = "Lead #{lead.full_name} unsubscribed from template #{template.slug}" out = Mailer.notify( '[email protected]', subject ) Rails.env.production? ? out.deliver_later : out.deliver_now Office::Unsubscribe.create({ lead_id: lead_id, template_id: config_json['template_id'], }) end |