Class: AboutYou::SDK::Model::FacetCounts

Inherits:
Object
  • Object
show all
Defined in:
lib/AboutYou/Model/ProductSearchResult/facet_counts.rb

Overview

This class represents a FacetCounts model.

author

Collins GmbH & Co KG

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product_count_total, product_count_with_other_facet, product_count_without_any_facet) ⇒ FacetCounts

the Constructor for the facetcounts 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::FacetCounts



32
33
34
35
36
37
38
39
40
# File 'lib/AboutYou/Model/ProductSearchResult/facet_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

#facet_count_listObject

an array of facetcount objects



13
14
15
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 13

def facet_count_list
  @facet_count_list
end

#group_idObject

The group_id of the facetcounts



11
12
13
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 11

def group_id
  @group_id
end

#product_count_totalObject

the cont of the products



15
16
17
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 15

def product_count_total
  @product_count_total
end

#product_count_with_other_facetObject

the count of the procuts with other facets



19
20
21
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 19

def product_count_with_other_facet
  @product_count_with_other_facet
end

#product_count_without_any_facetObject

the count of the products without facets



17
18
19
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 17

def product_count_without_any_facet
  @product_count_without_any_facet
end

Class Method Details

.create_from_json(group_id, json_object, facet_count_list) ⇒ Object

This method is used for creating an instance of this class by a json_object.

  • Args :

    • group_id -> the groupId of the facetcounts

    • json_object -> the jsonObject received from the api

    • facet_count_list -> a list of facetcount objects

  • Returns :

    • Instance of AboutYou::SDK::Model::FacetCounts



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/AboutYou/Model/ProductSearchResult/facet_counts.rb', line 53

def self.create_from_json(group_id, json_object, facet_count_list)
  facet_counts = new(
    json_object['total'],
    json_object['other'],
    json_object['missing']
  )
  facet_counts.group_id = group_id
  facet_counts.facet_count_list = facet_count_list

  facet_counts
end