Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation (and abstract class?) for custom delivery method #1621

Open
Mr0grog opened this issue Oct 23, 2024 · 0 comments
Open

Documentation (and abstract class?) for custom delivery method #1621

Mr0grog opened this issue Oct 23, 2024 · 0 comments

Comments

@Mr0grog
Copy link

Mr0grog commented Oct 23, 2024

I was recently trying to build a custom delivery method for this gem and tripped over a few minor things while doing so, owing to the lack of documentation. It would be helpful if there was some documentation about this in the README and/or if there was an abstract base class for delivery methods to inherit from, e.g:

module Mail
  class AbstractDelivery
    attr_reader :settings

    def initialize(settings = {})
      @settings = settings
    end

    def deliver!(message)
      raise NotImplementedError, "`deliver!` method is not implemented on #{self.class.name}"
    end
  end
end

One of the things that surprised me, for example, was that I needed to expose a #settings attribute with the settings hash that was passed into the constructor.

(I was also surprised by the differing return values from Message#deliver and Message#deliver!, but that's not really an issue with the delivery method, and someone already posted a PR for that: #1313.)

I’m happy to write a PR for this; just let me know whether the abstract class is desirable in addition to docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant