Class: AboutYou::SDK::Model::Facet
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::Facet
- Defined in:
- lib/AboutYou/Model/facet.rb
Overview
This class represents a Facet model
Constant Summary collapse
- FACET_BRAND =
Group Id for Brands
0
- FACET_COLOR =
Group Id for Color
1
- FACET_SIZE =
Group Id for Size
2
- FACET_GENDERAGE =
Group Id for Gender/Age
3
- FACET_CUPSIZE =
Group Id for Cupsize
4
- FACET_LENGTH =
Group Id for Length
5
- FACET_DIMENSION3 =
Group Id for Dimensions
6
- FACET_SIZE_CODE =
Group Id for Size-Codes
206
- FACET_SIZE_RUN =
Group Id for Size_Run
172
- FACET_CLOTHING_UNISEX_INT =
Group Id for Clothing_Unisex_Int
173
- FACET_CLOTHING_UNISEX_INCH =
Group Id for Clothing_Unisex_Inch
174
- FACET_SHOES_UNISEX_EUR =
Group Id for Clothing_Unisex_Eur
194
- FACET_CLOTHING_WOMEN_DE =
Group Id for Clothing_Women_DE
175
- FACET_CLOTHING_UNISEX_ONESIZE =
Group Id for Clothing_Unisex_Onesize
204
- FACET_SHOES_UNISEX_ADIDAS_EUR =
Group Id for Shoes_Unisex_Adidas_Eur
195
- FACET_CLOTHING_WOMEN_BELTS_CM =
Group Id for Clothing_Women_Belts_Cm
181
- FACET_CLOTHING_WOMEN_INCH =
Group Id for Clothing_Women_Inch
180
- FACET_CLOTHING_MEN_BELTS_CM =
Group Id for Clothing_Men_Belts_Cm
190
- FACET_CLOTHING_MEN_INCH =
Group Id for Clothing_Men_Inch
189
- FACET_CLOTHING_MEN_DE =
Group Id for Clothing_Men_De
187
- FACET_CONDITION =
Group Id for Condition
234
- FACET_QUANTITY_PER_PACK =
Group Id for Quantity_Per_Pack
263
- FACET_SEASON_CODE =
Group Id for Season Code
289
- FACETS_ALL =
api-call name for requiring all facets
'_all'
- FACETS_UNLIMITED =
api-call-value for requiring unlimited facets
-1
Instance Attribute Summary collapse
-
#group_id ⇒ Object
id of the group of the facet.
-
#group_name ⇒ Object
name of the group of the facet.
-
#id ⇒ Object
id of the facet.
-
#json_object ⇒ Object
json_object with which this instance was created.
-
#name ⇒ Object
name of the facet.
-
#options ⇒ Object
options of the facet.
-
#value ⇒ Object
value of the facet.
Class Method Summary collapse
-
.create_from_json(json_object) ⇒ Object
This method is used for creating an instance of this class by a json_object.
Instance Method Summary collapse
-
#initialize(id, name, value, group_id, group_name, options = nil) ⇒ Facet
constructor
Constructor for the AboutYou::SDK::Model::Facet class.
-
#option(key) ⇒ Object
Getter for options.
-
#unique_key(group_id = nil, facet_id = nil) ⇒ Object
This method is used for creating a unique key for a facet.
Constructor Details
#initialize(id, name, value, group_id, group_name, options = nil) ⇒ Facet
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
-
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/AboutYou/Model/facet.rb', line 88 def initialize(id, name, value, group_id, group_name, = nil) self.id = id self.name = name self.value = value self.group_id = group_id self.group_name = group_name self. = self end |
Instance Attribute Details
#group_id ⇒ Object
id of the group of the facet
68 69 70 |
# File 'lib/AboutYou/Model/facet.rb', line 68 def group_id @group_id end |
#group_name ⇒ Object
name of the group of the facet
70 71 72 |
# File 'lib/AboutYou/Model/facet.rb', line 70 def group_name @group_name end |
#id ⇒ Object
id of the facet
62 63 64 |
# File 'lib/AboutYou/Model/facet.rb', line 62 def id @id end |
#json_object ⇒ Object
json_object with which this instance was created
60 61 62 |
# File 'lib/AboutYou/Model/facet.rb', line 60 def json_object @json_object end |
#name ⇒ Object
name of the facet
64 65 66 |
# File 'lib/AboutYou/Model/facet.rb', line 64 def name @name end |
#options ⇒ Object
options of the facet
72 73 74 |
# File 'lib/AboutYou/Model/facet.rb', line 72 def @options end |
#value ⇒ Object
value of the facet
66 67 68 |
# File 'lib/AboutYou/Model/facet.rb', line 66 def value @value end |
Class Method Details
.create_from_json(json_object) ⇒ Object
This method is used for creating an instance of this class by a json_object.
-
Args :
-
json_object
-> the json_object received from the api
-
-
Returns :
-
Instance of AboutYou::SDK::Model::Facet
-
108 109 110 111 112 113 114 115 116 117 |
# 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 |
Instance Method Details
#option(key) ⇒ Object
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
-
146 147 148 149 150 151 |
# File 'lib/AboutYou/Model/facet.rb', line 146 def option(key) return unless .each do |option| return option['value'] if option['key'] == key end end |
#unique_key(group_id = nil, facet_id = nil) ⇒ Object
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
-
129 130 131 132 133 134 135 |
# 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 |