Class: AboutYou::SDK::Model::SaleCounts
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::SaleCounts
- Defined in:
- lib/AboutYou/Model/ProductSearchResult/sale_counts.rb
Overview
This class represents a Sale Counts model.
- author
-
Collins GmbH & Co KG
Instance Attribute Summary collapse
-
#product_count_in_sale ⇒ Object
count of products in sale.
-
#product_count_not_in_sale ⇒ Object
count of prodocuts not in sale.
-
#product_count_total ⇒ Object
count of total products.
-
#product_count_with_other_facet ⇒ Object
count of products with other facets.
-
#product_count_without_any_facet ⇒ Object
count of products without 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(product_count_total, product_count_with_other_facet, product_count_without_any_facet) ⇒ SaleCounts
constructor
the Constructor for the sale counts class.
-
#parse_terms(json_terms) ⇒ Object
This method is used for parsing the terms of the json_object.
Constructor Details
#initialize(product_count_total, product_count_with_other_facet, product_count_without_any_facet) ⇒ SaleCounts
the Constructor for the sale counts class
-
Args :
-
product_count_total-> the total productcount -
product_count_with_other_facet-> the productcount without any facets -
product_count_without_any_facet-> the productcount with other facets
-
-
Returns :
-
Instance of AboutYou::SDK::Model::SaleCounts
-
32 33 34 35 36 37 38 39 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 32 def initialize(product_count_total, product_count_with_other_facet, product_count_without_any_facet ) self.product_count_total = product_count_total self.product_count_with_other_facet = product_count_with_other_facet self.product_count_without_any_facet = product_count_without_any_facet end |
Instance Attribute Details
#product_count_in_sale ⇒ Object
count of products in sale
11 12 13 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 11 def product_count_in_sale @product_count_in_sale end |
#product_count_not_in_sale ⇒ Object
count of prodocuts not in sale
13 14 15 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 13 def product_count_not_in_sale @product_count_not_in_sale end |
#product_count_total ⇒ Object
count of total products
15 16 17 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 15 def product_count_total @product_count_total end |
#product_count_with_other_facet ⇒ Object
count of products with other facets
19 20 21 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 19 def product_count_with_other_facet @product_count_with_other_facet end |
#product_count_without_any_facet ⇒ Object
count of products without facet
17 18 19 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 17 def product_count_without_any_facet @product_count_without_any_facet 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 jsonObject received from the api
-
-
Returns :
-
Instance of AboutYou::SDK::Model::SaleCounts
-
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 50 def self.create_from_json(json_object) sale_counts = new( json_object['total'], json_object['other'], json_object['missing'] ) sale_counts.parse_terms(json_object['terms']) sale_counts end |
Instance Method Details
#parse_terms(json_terms) ⇒ Object
This method is used for parsing the terms of the json_object
-
Args :
-
jsonTerms-> the terms of the json_object received from the api
-
67 68 69 70 71 72 73 74 75 |
# File 'lib/AboutYou/Model/ProductSearchResult/sale_counts.rb', line 67 def parse_terms(json_terms) json_terms.each do |term| if term['term'] == 0 self.product_count_not_in_sale = term['count'] else self.product_count_in_sale = term['count'] end end end |