Platoniq/decidim-verifications-direct_verifications

View on GitHub
app/mailers/decidim/direct_verifications/stats.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Decidim
  module DirectVerifications
    class Stats
      attr_reader :count, :successful, :errors

      def self.from(instrumenter, type)
        new(
          count: instrumenter.emails_count(type),
          successful: instrumenter.processed_count(type),
          errors: instrumenter.errors_count(type)
        )
      end

      def initialize(count:, successful:, errors:)
        @count = count
        @successful = successful
        @errors = errors
      end
    end
  end
end