2018-12-14 05:06:12 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-28 15:19:43 -04:00
|
|
|
module ActionMailbox
|
2019-01-15 10:55:42 -05:00
|
|
|
# See +ActionMailbox::Base+ for how to specify routing.
|
2018-09-28 15:19:43 -04:00
|
|
|
module Routing
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2018-10-17 12:38:26 -04:00
|
|
|
included do
|
|
|
|
cattr_accessor :router, default: ActionMailbox::Router.new
|
|
|
|
end
|
2018-09-28 15:19:43 -04:00
|
|
|
|
2018-10-17 12:38:26 -04:00
|
|
|
class_methods do
|
2018-09-28 15:19:43 -04:00
|
|
|
def routing(routes)
|
2018-10-17 12:38:26 -04:00
|
|
|
router.add_routes(routes)
|
2018-09-28 15:19:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def route(inbound_email)
|
2018-10-17 12:38:26 -04:00
|
|
|
router.route(inbound_email)
|
2018-09-28 15:19:43 -04:00
|
|
|
end
|
2019-05-04 13:53:08 -04:00
|
|
|
|
|
|
|
def mailbox_for(inbound_email)
|
2019-05-05 15:09:32 -04:00
|
|
|
router.mailbox_for(inbound_email)
|
2019-05-04 13:53:08 -04:00
|
|
|
end
|
2018-09-28 15:19:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|