Sha256: 6920ddb62369c4cb15e05c8d5f878d18c01139a1787606bc31948a22373e3358

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

module Workarea
  module Orderbot
    module Filters
      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

      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

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-orderbot-1.0.2 app/services/workarea/orderbot/filters.rb
workarea-orderbot-1.0.1 app/services/workarea/orderbot/filters.rb
workarea-orderbot-1.0.0 app/services/workarea/orderbot/filters.rb