Class: Jobshop::Mailroom::BaseHandler
- Inherits:
-
Object
- Object
- Jobshop::Mailroom::BaseHandler
- Defined in:
- lib/jobshop/mailroom/base_handler.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#customer_contact ⇒ Object
Returns the value of attribute customer_contact.
-
#from ⇒ Object
Returns the value of attribute from.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(message, mailman) ⇒ BaseHandler
constructor
A new instance of BaseHandler.
Constructor Details
#initialize(message, mailman) ⇒ BaseHandler
Returns a new instance of BaseHandler.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 16 def initialize(, mailman) self.organization = mailman.organization self.to = Mail::Address.new(.to.first) self.from = Mail::Address.new(.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 = .subject self.content = parse_body() end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def content @content end |
#customer ⇒ Object
Returns the value of attribute customer.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def customer @customer end |
#customer_contact ⇒ Object
Returns the value of attribute customer_contact.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def customer_contact @customer_contact end |
#from ⇒ Object
Returns the value of attribute from.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def from @from end |
#organization ⇒ Object
Returns the value of attribute organization.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def organization @organization end |
#subject ⇒ Object
Returns the value of attribute subject.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
6 7 8 |
# File 'lib/jobshop/mailroom/base_handler.rb', line 6 def to @to end |