class Jobshop::Mailroom::BaseHandler
Attributes
content[RW]
customer[RW]
customer_contact[RW]
from[RW]
organization[RW]
subject[RW]
to[RW]
Public Class Methods
new(message, mailman)
click to toggle source
# File lib/jobshop/mailroom/base_handler.rb, line 16 def initialize(message, mailman) self.organization = mailman.organization self.to = Mail::Address.new(message.to.first) self.from = Mail::Address.new(message.from.first) self.customer_contact = organization.customer_contacts .find_by(email: from.address) self.customer = customer_contact&.customer || organization.customers.find_by(from_domain) self.subject = message.subject self.content = parse_body(message) end