Sha256: 380137c33c0cb7c2da2597685f17c69945229247fdd91a079b86bcafde81a4be

Contents?: true

Size: 749 Bytes

Versions: 7

Compression:

Stored size: 749 Bytes

Contents

module Devise
  module Async
    module Backend
      class Base
        def self.enqueue(*args)
          raise NotImplementedError, "Any DeviseAssync::Backend subclass should implement `self.enqueue`."
        end

        # Loads the resource record and sends the email.
        #
        # It uses `orm_adapter` API to fetch the record in order to enforce
        # compatibility among diferent ORMs.
        def perform(method, resource_class, resource_id)
          resource = resource_class.constantize.to_adapter.get!(resource_id)
          mailer_class.send(method, resource).deliver
        end

        private

        def mailer_class
          @mailer_class ||= Devise::Async.mailer.constantize
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devise-async-0.5.1 lib/devise/async/backend/base.rb
devise-async-0.5.0 lib/devise/async/backend/base.rb
devise-async-0.4.0 lib/devise/async/backend/base.rb
devise-async-0.3.1 lib/devise/async/backend/base.rb
devise-async-0.3.0 lib/devise/async/backend/base.rb
devise-async-0.2.0 lib/devise/async/backend/base.rb
devise-async-0.1.1 lib/devise/async/backend/base.rb