Module: Workarea::Orderbot::Filters
- Included in:
- ChildProduct, ParentProduct
- Defined in:
- app/services/workarea/orderbot/filters.rb
Instance Method Summary collapse
Instance Method Details
#add_filter_values(filters, new_filter) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/services/workarea/orderbot/filters.rb', line 4 def add_filter_values(filters, new_filter) key = new_filter.keys.first val = new_filter[key] if filters.key?(key) filters[key] << val filters[key] = filters[key].uniq else filters[key] = [val] end filters end |
#first_variable ⇒ Object
18 19 20 21 22 23 |
# File 'app/services/workarea/orderbot/filters.rb', line 18 def first_variable return {} unless product_details[:first_variable].present? && product_details[:first_variable][:type].present? { product_details[:first_variable][:type] => product_details[:first_variable][:value] }.compact end |
#second_variable ⇒ Object
25 26 27 28 29 30 |
# File 'app/services/workarea/orderbot/filters.rb', line 25 def second_variable return {} unless product_details[:second_variable].present? && product_details[:second_variable][:type].present? { product_details[:second_variable][:type] => product_details[:second_variable][:value] }.compact end |