Class: Decidim::DirectVerifications::Stats

Inherits:
Object
  • Object
show all
Defined in:
app/mailers/decidim/direct_verifications/stats.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(count:, successful:, errors:) ⇒ Stats

Returns a new instance of Stats.



16
17
18
19
20
# File 'app/mailers/decidim/direct_verifications/stats.rb', line 16

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

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



6
7
8
# File 'app/mailers/decidim/direct_verifications/stats.rb', line 6

def count
  @count
end

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'app/mailers/decidim/direct_verifications/stats.rb', line 6

def errors
  @errors
end

#successfulObject (readonly)

Returns the value of attribute successful.



6
7
8
# File 'app/mailers/decidim/direct_verifications/stats.rb', line 6

def successful
  @successful
end

Class Method Details

.from(instrumenter, type) ⇒ Object



8
9
10
11
12
13
14
# File 'app/mailers/decidim/direct_verifications/stats.rb', line 8

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