Module: EmailCampaign::Handler
- Defined in:
- lib/email_campaign/handler.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#asset ⇒ Object
deprecated, remove after 4/1/2013.
- #link ⇒ Object
- #open ⇒ Object
- #resubscribe ⇒ Object
- #unsubscribe ⇒ Object
- #web_version ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/email_campaign/handler.rb', line 4 def self.included(base) EmailCampaign::Config.controller_name = base.controller_name end |
Instance Method Details
#asset ⇒ Object
deprecated, remove after 4/1/2013
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/email_campaign/handler.rb', line 18 def asset EmailCampaign::Recipient.record_open(params[:k]) if params[:k] = {} [:disposition] = [ 'jpg', 'jpeg', 'gif', 'png' ].include?(params[:format].downcase) ? 'inline' : 'attachment' path = File.join(Rails.root, 'app', 'assets', 'images', 'email', params[:method].to_s, params[:filename] + '.' + params[:format]) if !File.exists?(path) path = File.join(Rails.root, 'app', 'assets', 'images', 'email', params[:filename] + '.' + params[:format]) end render :text => 'Not Found', :status => 404 and return if !File.exists?(path) send_file path, end |
#link ⇒ Object
33 34 35 36 |
# File 'lib/email_campaign/handler.rb', line 33 def link EmailCampaign::Recipient.record_click(params[:k]) if params[:k] redirect_to params[:url] end |
#open ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/email_campaign/handler.rb', line 8 def open EmailCampaign::Recipient.record_open(params[:k]) if params[:k] = {} [:disposition] = 'inline' path = File.join(Rails.root, 'public/assets/email_campaign/open-tracker.gif') send_file path, end |
#resubscribe ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/email_campaign/handler.rb', line 46 def resubscribe if params[:k] @success = EmailCampaign::Recipient.resubscribe(params[:k]) else render :text => "No subscriber identifier given, cannot continue." end end |
#unsubscribe ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/email_campaign/handler.rb', line 38 def unsubscribe if params[:k] @success = EmailCampaign::Recipient.unsubscribe(params[:k]) else render :text => "No subscriber identifier given, cannot continue." end end |
#web_version ⇒ Object
54 55 56 57 |
# File 'lib/email_campaign/handler.rb', line 54 def web_version EmailCampaign::Recipient.record_click(params[:k]) if params[:k] redirect_to :action => params[:id] end |