Class: Bushido::MailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bushido::MailController
- Defined in:
- app/controllers/bushido/mail_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
POST /bushido/mail.
Instance Method Details
#index ⇒ Object
POST /bushido/mail
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/bushido/mail_controller.rb', line 6 def index puts "Handling email!" mail = {} = [] # Strip the attachments first params.keys.each do |key| << params.delete(key) if key =~ /attachment-\d+/ end # Copy the params to the hook data (params.keys - ["controller", "action"]).each do |param| mail[param.downcase] = params[param] end mail["attachments"] = puts "params: #{params.inspect}" puts "mail: #{mail.inspect}" # Output for debugging remotely Bushido::Mailroute.pretty_print_routes puts "Finished routing" # Mailroute is in charge of figuring out which callback to trigger Bushido::Mailroute.routes.process(mail) result = {:success => true, :message => nil, :data => {}} render :text => result.to_json, :status => 200 end |