Class: Spree::Api::V3::FiltersAggregator
- Inherits:
-
Object
- Object
- Spree::Api::V3::FiltersAggregator
- Defined in:
- app/services/spree/api/v3/filters_aggregator.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(scope:, currency:, category: nil, option_value_ids: [], scope_before_options: nil) ⇒ FiltersAggregator
constructor
A new instance of FiltersAggregator.
Constructor Details
#initialize(scope:, currency:, category: nil, option_value_ids: [], scope_before_options: nil) ⇒ FiltersAggregator
Returns a new instance of FiltersAggregator.
10 11 12 13 14 15 16 |
# File 'app/services/spree/api/v3/filters_aggregator.rb', line 10 def initialize(scope:, currency:, category: nil, option_value_ids: [], scope_before_options: nil) @scope = scope @currency = currency @category = category @option_value_ids = option_value_ids = || scope end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/services/spree/api/v3/filters_aggregator.rb', line 18 def call { filters: build_filters, sort_options: , default_sort: to_api_sort(@category&.sort_order || 'manual'), total_count: @scope.distinct.count } end |