Hey Scott,

There’s an ActionMailbox::BaseController already, so I think you could do this 
in an engine:

# Follows the format of 
https://github.com/rails/rails/blob/62105f0aed847f0ab4012e1b91e094e218aa9e08/actionmailbox/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb
class ActionMailbox::Ingresses::Postage::InboundEmailsController < 
ActionMailbox::BaseController
  before_action :authenticate

   def create
      ActionMailbox::InboundEmail.create_and_extract_message_id! 
params.require(…)
    end

  private
    def authenticate
      # Hey oh!
    end
end

And you’d need to setup a route in your engine that matches: 
https://github.com/rails/rails/blob/62105f0aed847f0ab4012e1b91e094e218aa9e08/actionmailbox/config/routes.rb#L7

Then config.action_mailbox.ingress = :postage should work.

Or perhaps you already tried something like this? :)

--
Kasper

> On 7 Mar 2019, at 01.38, Scott Tadman <tad...@postageapp.com> wrote:
> 
> The current implementation of ActionMailbox comes with a number of ingress 
> options out of the box, but as far as I can tell there's no obvious way to 
> add support for others without making a pull request to the Rails core and 
> including a complete implementation.
> 
> I run a Rails-based email platform with an existing Ruby gem that we're 
> looking to extend to include ActionMailbox support. Based on testing versus 
> the Rails 6 beta it looks like adding options could be considerably easier 
> either through documentation or through support for loadable modules.
> 
> Issues Faced
> 
> The ActionMailbox ingress options are baked in to the ActionMailbox library.
> 
> Proposal
> 
> Adding ingress options to ActionMailbox should be an easy process based on 
> following guidelines and examples.
> 
> So the two obvious options are:
> 
> 1. A non-invasive method would be to develop a well-documented example in the 
> form of a minimal gem that uses dependency injection to create the 
> appropriate ActionMailbox ingress routes and controllers. This would be a 
> Rails engine-type package that can be easily added or removed to any Rails 6 
> application.
> 
> 2. A more direct method would be to develop a plug-in or module system for 
> ActionMailbox that makes it easier to define ingress handlers, not unlike how 
> ActionMailer's handler can be extended or replaced in your Rails config very 
> easily with a minimum of fuss.
> 
> Both of these allow third parties to independently iterate and improve on 
> their ActionMailbox integrations without having to wait for a new 
> ActionMailbox release for updates, so that could benefit everyone, even 
> existing implementations.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-core+unsubscr...@googlegroups.com 
> <mailto:rubyonrails-core+unsubscr...@googlegroups.com>.
> To post to this group, send email to rubyonrails-core@googlegroups.com 
> <mailto:rubyonrails-core@googlegroups.com>.
> Visit this group at https://groups.google.com/group/rubyonrails-core 
> <https://groups.google.com/group/rubyonrails-core>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to