diff options
author | 2010-08-06 17:18:21 +0200 | |
---|---|---|
committer | 2010-12-02 21:48:39 +0100 | |
commit | 88f24642bd789ac41a86fe34ffe469cf9f0521a3 (patch) | |
tree | 0d3ca69c76c018c64a18acde50445db75d982d83 /app | |
parent | Send emails as delayed job (diff) | |
download | recruiting-webapp-88f24642bd789ac41a86fe34ffe469cf9f0521a3.tar.gz recruiting-webapp-88f24642bd789ac41a86fe34ffe469cf9f0521a3.tar.bz2 recruiting-webapp-88f24642bd789ac41a86fe34ffe469cf9f0521a3.zip |
Email answers allow checking signatures
Use Mail gem for receiving emails. Changed fixture email question to require a
valid signature. Tests for signatures validation.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/email_answer.rb | 1 | ||||
-rw-r--r-- | app/models/receiver.rb | 8 | ||||
-rw-r--r-- | app/models/user_mailer.rb | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/app/models/email_answer.rb b/app/models/email_answer.rb index ffec1ac..fe21fb1 100644 --- a/app/models/email_answer.rb +++ b/app/models/email_answer.rb @@ -14,6 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Model storing answers for questions with email content. # No user is allowed to do anything except viewing. +require 'message.rb' class EmailAnswer < Answer fields do correct :boolean diff --git a/app/models/receiver.rb b/app/models/receiver.rb new file mode 100644 index 0000000..2235984 --- /dev/null +++ b/app/models/receiver.rb @@ -0,0 +1,8 @@ +require 'message.rb' +class Receiver + def self.receive(text) + # For now email answers for questions are only emails app receives + # so try use any received email as answer. + EmailAnswer.answer_from_email(Mail::Message.new(text)) + end +end diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb index 1263e58..b405c8e 100644 --- a/app/models/user_mailer.rb +++ b/app/models/user_mailer.rb @@ -70,10 +70,4 @@ class UserMailer < ActionMailer::Base @body = { :email => email, :app_name => @app_name, :fields => fields } end - - def receive(email) - # For now email answers for questions are only emails app receives - # so try use any received email as answer. - EmailAnswer.answer_from_email(email) - end end |