Class: FatFreeCRM::Cloudfuji::EventObservers::EmailObserver
- Inherits:
-
Cloudfuji::EventObserver
- Object
- Cloudfuji::EventObserver
- FatFreeCRM::Cloudfuji::EventObservers::EmailObserver
- Includes:
- Base
- Defined in:
- lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb
Instance Method Summary collapse
-
#email_clicked ⇒ Object
:event=>“clicked” :recipient=>“[email protected]” :domain=>“cloudfuji.com” :campaign_id=>“cloudfuji_buddies” :campaign_name=>“Cloudfuji Buddies” :tag=>nil :mailing_list=>nil :custom_variables=>nil :url=>“cloudfuji.com/cas/invite/?invitation_token=8hswc7kqhPys6FsUJ1Nm&service=https://cloudfuji.com/users/service&redirect=https://cloudfuji.com/apps/new?app=fat_free_crm&src=icon” :human=>“[email protected] clicked on link in Cloudfuji Buddies to cloudfuji.com/cas/invite/?invitation_token=8hswc7kqhPys6FsUJ1Nm&service=https://cloudfuji.com/users/service&redirect=https://cloudfuji.com/apps/new?app=fat_free_crm&src=icon”}.
-
#email_delivered ⇒ Object
“email_delivered” :message_headers => “[["Received", "by luna.mailgun.net with SMTP mgrt 7313261; Tue, 20 Mar 2012 19:00:58 0000"], ["Received", "from localhost.localdomain (ec2-23-20-14-40.compute-1.amazonaws.com [23.20.14.40]) by mxa.mailgun.org with ESMTP id 4f68d3e9.4ddcdf0-luna; Tue, 20 Mar 2012 19:00:57 -0000 (UTC)"], ["Date", "Tue, 20 Mar 2012 19:00:57 0000"], ["From", "Sean Grove <[email protected]>"], ["Reply-To", "Cloudfuji Team <[email protected]>"], ["Message-Id", "<[email protected]>"], ["X-Mailgun-Campaign-Id", "cloudfuji_buddies"], ["Repy-To", "[email protected]"], ["To", "[email protected]"], ["Subject", "Cloudfuji Beta: Thank you for your early support. Here’s a gift for you."], ["List-Unsubscribe", "<u+na6wcn3gmqzdszbsmrrdam3ghfstkzrxgbstgn3fgvtdgzjumvrgmyzgmm6tqnlkgetheplteuzeey3gmrsw23zfgqyge5ltnbus4zdpez2d2jjsietgipjrmi4a@email.cloudfuji.com>"], ["X-Mailgun-Sid", "WyI2NWQ4MSIsICJzK2NmZGVtb0BidXNoaS5kbyIsICIxYjgiXQ=="], ["Sender", "[email protected]"]]” :message_id =>“<[email protected]>” :recipient => “[email protected]” :domain => “cloudfuji.com” :custom_variables => nil :human =>“Mail to [email protected] successfully delievered.”}}.
-
#email_opened ⇒ Object
“email_opened” :recipient=>“[email protected]” :domain=>“cloudfuji.com” :campaign_id=>“cloudfuji_buddies” :campaign_name=>“Cloudfuji Buddies” :tag=>nil :mailing_list=>nil :custom_variables=>nil.
- #email_received ⇒ Object
- #email_sent ⇒ Object
- #email_subscribed ⇒ Object
Methods included from Base
#find_lead_by_data, #find_or_create_activity_subject!
Instance Method Details
#email_clicked ⇒ Object
:event=>“clicked” :recipient=>“[email protected]” :domain=>“cloudfuji.com” :campaign_id=>“cloudfuji_buddies” :campaign_name=>“Cloudfuji Buddies” :tag=>nil :mailing_list=>nil :custom_variables=>nil :url=>“cloudfuji.com/cas/invite/?invitation_token=8hswc7kqhPys6FsUJ1Nm&service=https://cloudfuji.com/users/service&redirect=https://cloudfuji.com/apps/new?app=fat_free_crm&src=icon” :human=>“[email protected] clicked on link in Cloudfuji Buddies to cloudfuji.com/cas/invite/?invitation_token=8hswc7kqhPys6FsUJ1Nm&service=https://cloudfuji.com/users/service&redirect=https://cloudfuji.com/apps/new?app=fat_free_crm&src=icon”}
50 51 52 53 54 55 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 50 def email_clicked = "#{email} clicked #{data['url']}" += "in email campaign '#{campaign.titleize}'" if campaign note_email_activity() end |
#email_delivered ⇒ Object
“email_delivered” :message_headers => “[["Received", "by luna.mailgun.net with SMTP mgrt 7313261; Tue, 20 Mar 2012 19:00:58 0000"], ["Received", "from localhost.localdomain (ec2-23-20-14-40.compute-1.amazonaws.com [23.20.14.40]) by mxa.mailgun.org with ESMTP id 4f68d3e9.4ddcdf0-luna; Tue, 20 Mar 2012 19:00:57 -0000 (UTC)"], ["Date", "Tue, 20 Mar 2012 19:00:57 0000"], ["From", "Sean Grove <[email protected]>"], ["Reply-To", "Cloudfuji Team <[email protected]>"], ["Message-Id", "<[email protected]>"], ["X-Mailgun-Campaign-Id", "cloudfuji_buddies"], ["Repy-To", "[email protected]"], ["To", "[email protected]"], ["Subject", "Cloudfuji Beta: Thank you for your early support. Here’s a gift for you."], ["List-Unsubscribe", "<u+na6wcn3gmqzdszbsmrrdam3ghfstkzrxgbstgn3fgvtdgzjumvrgmyzgmm6tqnlkgetheplteuzeey3gmrsw23zfgqyge5ltnbus4zdpez2d2jjsietgipjrmi4a@email.cloudfuji.com>"], ["X-Mailgun-Sid", "WyI2NWQ4MSIsICJzK2NmZGVtb0BidXNoaS5kbyIsICIxYjgiXQ=="], ["Sender", "[email protected]"]]” :message_id =>“<[email protected]>” :recipient => “[email protected]” :domain => “cloudfuji.com” :custom_variables => nil :human =>“Mail to [email protected] successfully delievered.”}}
16 17 18 19 20 21 22 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 16 def email_delivered = "" += "Email delivered to #{email}" += " in email campaign '#{campaign.titleize}'" if campaign note_email_activity( .strip ) end |
#email_opened ⇒ Object
“email_opened” :recipient=>“[email protected]” :domain=>“cloudfuji.com” :campaign_id=>“cloudfuji_buddies” :campaign_name=>“Cloudfuji Buddies” :tag=>nil :mailing_list=>nil :custom_variables=>nil
32 33 34 35 36 37 38 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 32 def email_opened = "" += "Email opened by #{email}" += " in email campaign '#{campaign.titleize}'" if campaign note_email_activity( .strip ) end |
#email_received ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 62 def email_received user = find_user_by_account return unless user lead = Lead.find_by_email(data['from']) create_email_from_data( :direction => 'received', :mediator => lead, :user => user ) end |
#email_sent ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 73 def email_sent user = find_user_by_account return unless user # Find first Lead from 'to' email addresses lead = data['to'].to_s.split(";").detect do |email| lead = Lead.find_by_email(email) end create_email_from_data( :direction => 'sent', :mediator => lead, :user => user ) end |
#email_subscribed ⇒ Object
58 59 60 |
# File 'lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb', line 58 def email_subscribed note_email_activity("#{email} subscribed to a mailing list") end |