class Jobshop::Mailroom::RFQHandler

Public Instance Methods

process() click to toggle source
# File lib/jobshop/mailroom/rfq_handler.rb, line 8
def process
  new_rfq = organization.rfqs.create!({
    requested_by: customer_contact,
    customer: customer,
    from: from,
    subject: subject,
    content: content
  })

  if customer_contact
    RFQResponderMailer.with(customer_contact: customer_contact)
      .verified_contact.deliver_later
  end
  # TODO: Send rfq to quoting queue with low priority if customer.nil?
  return new_rfq
end

Private Instance Methods

from_domain() click to toggle source
# File lib/jobshop/mailroom/rfq_handler.rb, line 25
        def from_domain
  [ "reverse(lower(email_from_domain)) LIKE ?",
    "#{from.domain.reverse.downcase}%" ]
end
parse_body(message) click to toggle source
# File lib/jobshop/mailroom/rfq_handler.rb, line 30
        def parse_body(message)
  if message.multipart?
    message.parts[0].decode_body
  else
    message.decode_body
  end
end