Class: EmailLogsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- EmailLogsController
- Defined in:
- app/controllers/email_logs_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#dashboard, #keyboard_tools, #upload
Instance Method Details
#log ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/email_logs_controller.rb', line 7 def log = request.headers['X-Amz-SNS-Message-Type'] if ['SubscriptionConfirmation', 'Notification'].include? verifier = Aws::SNS::MessageVerifier.new body = request.body.read if verifier.authentic? body aws_data = JSON.parse body if == 'SubscriptionConfirmation' EmailLog.create(log_type: 'SubscriptionConfirmation', data: aws_data) else = JSON.parse aws_data['Message'] log_type = ['notificationType'] destination = ['mail']['destination'].join(', ') EmailLog.create(log_type: log_type, destination: destination, data: aws_data['Message']) end render plain: 'OK' else render plain: "You're not AWS. Go away.", status: 401 end end end |