Sha256: b2e7cff63933e311dd33e3f42b2f65a43a67a1b78005b25304e28380ca14fcf2

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

##
##
class Office::LeadActionTemplate
  include Mongoid::Document
  include Mongoid::Timestamps

  has_many :lead_actions, class_name: '::Office::LeadAction', inverse_of: :lead_action_templates

  field     :slug
  validates :slug, presence: true

  field     :action_exe, type: :string
  # validates :action_exe, presence: true

  field     :config_json, type: Object, default: '{}'

  field     :kind, type: :string
  KIND_UNSUBSCRIBE_TEMPLATE = 'kind-unsubscribe-template'
  KIND_UNSUBSCRIBE_CAMPAIGN = 'kind-unsubscribe-campaign'
  KINDS                     = [ KIND_UNSUBSCRIBE_TEMPLATE, KIND_UNSUBSCRIBE_CAMPAIGN ]


  def unsubscribe_from_campaign
  end

  def unsubscribe_from_template
    template = EmailTemplate.find( ctx[:template_id] )
    subject  = "Lead #{lead.full_name} unsubscribed from template #{template.slug}"
    out      = Mailer.notify( 'poxlovi@gmail.com', subject )
    Rails.env.production? ? out.deliver_later : out.deliver_now
    Office::Unsubscribe.create({
      lead_id: lead_id,
      template_id: config_json['template_id'],
    })
  end


end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ish_models-0.0.33.283 lib/office/lead_action_template.rb
ish_models-0.0.33.282 lib/office/lead_action_template.rb
ish_models-0.0.33.281 lib/office/lead_action_template.rb
ish_models-0.0.33.280 lib/office/lead_action_template.rb
ish_models-0.0.33.279 lib/office/lead_action_template.rb
ish_models-0.0.33.278 lib/office/lead_action_template.rb
ish_models-0.0.33.277 lib/office/lead_action_template.rb
ish_models-0.0.33.276 lib/office/lead_action_template.rb
ish_models-0.0.33.275 lib/office/lead_action_template.rb
ish_models-0.0.33.274 lib/office/lead_action_template.rb
ish_models-0.0.33.273 lib/office/lead_action_template.rb
ish_models-0.0.33.272 lib/office/lead_action_template.rb
ish_models-0.0.33.271 lib/office/lead_action_template.rb