Class: Bidu::House::Report::Range
- Inherits:
-
Bidu::House::Report
- Object
- Bidu::House::Report
- Bidu::House::Report::Range
- Defined in:
- lib/bidu/house/report/range.rb
Constant Summary collapse
- ALLOWED_PARAMETERS =
[:period, :maximum, :minimum]
- DEFAULT_OPTION =
{ period: 1.day, scope: :all, minimum: nil, maximum: nil }
Instance Attribute Summary
Attributes inherited from Bidu::House::Report
Instance Method Summary collapse
- #as_json ⇒ Object
- #count ⇒ Object
- #error? ⇒ Boolean
-
#initialize(options) ⇒ Range
constructor
A new instance of Range.
- #scoped ⇒ Object
Methods inherited from Bidu::House::Report
Constructor Details
#initialize(options) ⇒ Range
Returns a new instance of Range.
16 17 18 |
# File 'lib/bidu/house/report/range.rb', line 16 def initialize() super(DEFAULT_OPTION.merge()) end |
Instance Method Details
#as_json ⇒ Object
28 29 30 31 32 33 |
# File 'lib/bidu/house/report/range.rb', line 28 def as_json { status: status, count: count } end |
#count ⇒ Object
35 36 37 |
# File 'lib/bidu/house/report/range.rb', line 35 def count scoped.count end |
#error? ⇒ Boolean
24 25 26 |
# File 'lib/bidu/house/report/range.rb', line 24 def error? @error ||= !count_in_range? end |
#scoped ⇒ Object
20 21 22 |
# File 'lib/bidu/house/report/range.rb', line 20 def scoped @scoped ||= fetch_scoped(last_entries, scope) end |