class AboutYou::SDK::Model::Facet
This class represents a Facet
model
Constants
- FACETS_ALL
api-call name for requiring all facets
- FACETS_UNLIMITED
api-call-value for requiring unlimited facets
- FACET_BRAND
Group Id for Brands
- FACET_CLOTHING_MEN_BELTS_CM
Group Id for Clothing_Men_Belts_Cm
- FACET_CLOTHING_MEN_DE
Group Id for Clothing_Men_De
- FACET_CLOTHING_MEN_INCH
Group Id for Clothing_Men_Inch
- FACET_CLOTHING_UNISEX_INCH
Group Id for Clothing_Unisex_Inch
- FACET_CLOTHING_UNISEX_INT
Group Id for Clothing_Unisex_Int
- FACET_CLOTHING_UNISEX_ONESIZE
Group Id for Clothing_Unisex_Onesize
- FACET_CLOTHING_WOMEN_BELTS_CM
Group Id for Clothing_Women_Belts_Cm
- FACET_CLOTHING_WOMEN_DE
Group Id for Clothing_Women_DE
- FACET_CLOTHING_WOMEN_INCH
Group Id for Clothing_Women_Inch
- FACET_COLOR
Group Id for Color
- FACET_CONDITION
Group Id for Condition
- FACET_CUPSIZE
Group Id for Cupsize
- FACET_DIMENSION3
Group Id for Dimensions
- FACET_GENDERAGE
Group Id for Gender/Age
- FACET_LENGTH
Group Id for Length
- FACET_QUANTITY_PER_PACK
Group Id for Quantity_Per_Pack
- FACET_SEASON_CODE
Group Id for Season Code
- FACET_SHOES_UNISEX_ADIDAS_EUR
Group Id for Shoes_Unisex_Adidas_Eur
- FACET_SHOES_UNISEX_EUR
Group Id for Clothing_Unisex_Eur
- FACET_SIZE
Group Id for Size
- FACET_SIZE_CODE
Group Id for Size-Codes
- FACET_SIZE_RUN
Group Id for Size_Run
Attributes
id of the group of the facet
name of the group of the facet
id of the facet
json_object
with which this instance was created
name of the facet
options of the facet
value of the facet
Public Class Methods
This method is used for creating an instance of this class by a json_object.
-
Args :
-
json_object
-> thejson_object
received from the api
-
-
Returns :
-
Instance of
AboutYou::SDK::Model::Facet
-
# File lib/AboutYou/Model/facet.rb, line 108 def self.create_from_json(json_object) new( json_object['facet_id'], json_object['name'], json_object['value'] ? json_object['value'] : nil, json_object['id'], json_object['group_name'], json_object['options'] ? json_object['options'] : nil ) end
Constructor for the AboutYou::SDK::Model::Facet
class
-
Args :
-
id
-> the id of the facet -
name
-> the name of the facet -
value
-> the value of the facet -
group_id
-> id of the group of the facet -
group_name
-> name of the group of the facet -
options
-> options of the facet
-
-
Returns :
-
an instance of
AboutYou::SDK::Model::Facet
-
# File lib/AboutYou/Model/facet.rb, line 88 def initialize(id, name, value, group_id, group_name, options = nil) self.id = id self.name = name self.value = value self.group_id = group_id self.group_name = group_name self.options = options self end
Public Instance Methods
Getter for options
-
Args :
-
key
-> The key for which options should be returned
-
-
Returns :
-
either null if no options are set or a String containing an option
-
# File lib/AboutYou/Model/facet.rb, line 146 def option(key) return unless options options.each do |option| return option['value'] if option['key'] == key end end
This method is used for creating a unique key for a facet
-
Args :
-
group_id
-> id of the group of a facet -
facet_id
-> id of a facet
-
-
Returns :
-
a String containing a unique key for a facet
-
# File lib/AboutYou/Model/facet.rb, line 129 def unique_key(group_id = nil, facet_id = nil) return String(group_id) + ':' + String(facet_id) unless group_id.nil? && facet_id.nil? String(self.group_id) + ':' + String(id) unless self.group_id.nil? && self.facet_id.nil? end