Class: Mercy::Report::Error
- Inherits:
-
ActiveRecord
- Object
- Mercy::Report
- ActiveRecord
- Mercy::Report::Error
- Defined in:
- lib/mercy/report/error.rb
Constant Summary collapse
- ALLOWED_PARAMETERS =
[:period, :threshold]
- DEFAULT_OPTION =
{ external_key: :id, threshold: 0.02, period: 1.day, scope: :with_error, base_scope: :all, uniq: false }
Instance Attribute Summary
Attributes inherited from Mercy::Report
Instance Method Summary collapse
- #as_json ⇒ Object
- #error? ⇒ Boolean
-
#initialize(options) ⇒ Error
constructor
A new instance of Error.
- #percentage ⇒ Object
- #scoped ⇒ Object
Methods inherited from Mercy::Report
Constructor Details
#initialize(options) ⇒ Error
Returns a new instance of Error.
17 18 19 |
# File 'lib/mercy/report/error.rb', line 17 def initialize() super(self.class::DEFAULT_OPTION.merge()) end |
Instance Method Details
#as_json ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/mercy/report/error.rb', line 33 def as_json { ids: ids, percentage: percentage, status: status } end |
#error? ⇒ Boolean
29 30 31 |
# File 'lib/mercy/report/error.rb', line 29 def error? @error ||= percentage > threshold end |
#percentage ⇒ Object
21 22 23 |
# File 'lib/mercy/report/error.rb', line 21 def percentage @percentage ||= fetch_percentage end |
#scoped ⇒ Object
25 26 27 |
# File 'lib/mercy/report/error.rb', line 25 def scoped @scoped ||= fetch_scoped(last_entries, scope) end |