class AboutYou::SDK::Criteria::ProductFields
This class is used for the selection of certain product fields which should be fetched in addition when making an api call
- author
-
Collins GmbH & Co KG
Constants
- ATTRIBUTES_MERGED
product field “attributes_merged”
- BRAND
product field “brand_id”
- CATEGORIES
product field “categories”
- DEFAULT_IMAGE
product field “default_image”
- DEFAULT_VARIANT
product field “default_variant”
- DESCRIPTION_LONG
product field “description_long”
- DESCRIPTION_SHORT
product field “description_short”
- INACTIVE_VARIANTS
product field “inactive_variants”
- IS_ACTIVE
id and name is set per default product field “is_active”
- IS_SALE
product field “sale”
- MAX_PRICE
product field “max_price”
- MAX_SAVINGS
product field “max_savings”
- MAX_SAVINGS_PERCENTAGE
product field “max_savings_percentage”
- MIN_PRICE
product field “min_price”
- TAGS
product field “tags”
- VARIANTS
product field “variants”
Public Class Methods
filters a given set of fields
-
Args :
-
fields
-> an Array of product fields which should be filtered
-
-
Returns :
-
a filtered Array of product fields
-
# File lib/AboutYou/Criteria/product_fields.rb, line 57 def self.filter_fields(fields) fields = fields.uniq # this simplifies parsing on (pre)fetching facets fields.push(ATTRIBUTES_MERGED) if fields.include?(ATTRIBUTES_MERGED) && (fields.include?(BRAND) || fields.include?(VARIANTS) || fields.include?(DEFAULT_VARIANT)) fields end
determines whether the api call has to require Categories or not
-
Args :
-
fields
-> an Array of product fields which should be filtered
-
-
Returns :
-
a boolean which is true when ap call has to require categories
-
# File lib/AboutYou/Criteria/product_fields.rb, line 96 def self.requires_categories(fields) fields.include?(CATEGORIES) end
determines whether the api call has to require Facets or not
-
Args :
-
fields
-> an Array of product fields which should be filtered
-
-
Returns :
-
a boolean which is true when ap call has to require facets
-
# File lib/AboutYou/Criteria/product_fields.rb, line 79 def self.requires_facets(fields) ([BRAND, VARIANTS, DEFAULT_VARIANT, ATTRIBUTES_MERGED ] & fields).count > 0 end