Class: Spree::Reporting::Counter
- Inherits:
-
Struct
- Object
- Struct
- Spree::Reporting::Counter
- Defined in:
- lib/spree/reporting/registry.rb
Overview
A point-in-time count of things that need attention right now: orders waiting to ship, returns waiting on a decision, variants running low. No time range, no currency and no base — a counter is not a report over a period but the state of the store at this instant, which is why it is evaluated by a lambda rather than compiled into the query.
Instance Attribute Summary collapse
-
#count ⇒ Object
->(store, channel:) returning an Integer.
-
#key_scope ⇒ Object
Returns the value of attribute key_scope.
-
#link ⇒ Object
Where the number leads, declared beside the count so the two cannot disagree:
{ resource: 'orders', filters: [{ field:, operator:, value: }] }. -
#name ⇒ Object
Returns the value of attribute name.
-
#nav ⇒ Object
Key of the sidebar entry this count badges, when it badges one.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#subject / key_scope(/ key_scope) ⇒ Object
Authorization, declared the same way as on metrics and dimensions, so a caller sees only the counters over data they may read.
Instance Attribute Details
#count ⇒ Object
->(store, channel:) returning an Integer. A channel narrows what can be narrowed (orders); store-wide facts such as stock ignore it.
224 |
# File 'lib/spree/reporting/registry.rb', line 224 Counter = Struct.new(:name, :count, :subject, :key_scope, :link, :nav, keyword_init: true) |
#key_scope ⇒ Object
Returns the value of attribute key_scope
224 225 226 |
# File 'lib/spree/reporting/registry.rb', line 224 def key_scope @key_scope end |
#link ⇒ Object
Where the number leads, declared beside the count so the two cannot
disagree: { resource: 'orders', filters: [{ field:, operator:, value: }] }.
Omitted when no list can honestly show exactly what was counted.
224 |
# File 'lib/spree/reporting/registry.rb', line 224 Counter = Struct.new(:name, :count, :subject, :key_scope, :link, :nav, keyword_init: true) |
#name ⇒ Object
Returns the value of attribute name
224 225 226 |
# File 'lib/spree/reporting/registry.rb', line 224 def name @name end |
#nav ⇒ Object
Key of the sidebar entry this count badges, when it badges one. The dashboard reads it rather than mapping counter names to nav entries itself, so an extension's counter can badge its own nav entry without a dashboard release.
224 |
# File 'lib/spree/reporting/registry.rb', line 224 Counter = Struct.new(:name, :count, :subject, :key_scope, :link, :nav, keyword_init: true) |
#subject ⇒ Object
Returns the value of attribute subject
224 225 226 |
# File 'lib/spree/reporting/registry.rb', line 224 def subject @subject end |
#subject / key_scope(/ key_scope) ⇒ Object
Authorization, declared the same way as on metrics and dimensions, so a caller sees only the counters over data they may read.
224 |
# File 'lib/spree/reporting/registry.rb', line 224 Counter = Struct.new(:name, :count, :subject, :key_scope, :link, :nav, keyword_init: true) |