class AboutYou::SDK::Model::SaleCounts
This class represents a Sale Counts model.
- author
-
Collins GmbH & Co KG
Attributes
count of products in sale
count of prodocuts not in sale
count of total products
count of products with other facets
count of products without facet
Public Class Methods
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
-
# 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
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
-
# 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
Public Instance Methods
This method is used for parsing the terms of the json_object
-
Args :
-
jsonTerms
-> the terms of the json_object received from the api
-
# 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