Class: Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaRating

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/retail_v2alpha/classes.rb,
lib/google/apis/retail_v2alpha/representations.rb,
lib/google/apis/retail_v2alpha/representations.rb

Overview

The rating of a Product.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudRetailV2alphaRating

Returns a new instance of GoogleCloudRetailV2alphaRating.



5723
5724
5725
# File 'lib/google/apis/retail_v2alpha/classes.rb', line 5723

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#average_ratingFloat

The average rating of the Product. The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is returned. Corresponds to the JSON property averageRating

Returns:

  • (Float)


5705
5706
5707
# File 'lib/google/apis/retail_v2alpha/classes.rb', line 5705

def average_rating
  @average_rating
end

#rating_countFixnum

The total number of ratings. This value is independent of the value of rating_histogram. This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned. Corresponds to the JSON property ratingCount

Returns:

  • (Fixnum)


5712
5713
5714
# File 'lib/google/apis/retail_v2alpha/classes.rb', line 5712

def rating_count
  @rating_count
end

#rating_histogramArray<Fixnum>

List of rating counts per rating value (index = rating - 1). The list is empty if there is no rating. If the list is non-empty, its size is always 5. Otherwise, an INVALID_ARGUMENT error is returned. For example, [41, 14, 13, 47, 303]. It means that the Product got 41 ratings with 1 star, 14 ratings with 2 star, and so on. Corresponds to the JSON property ratingHistogram

Returns:

  • (Array<Fixnum>)


5721
5722
5723
# File 'lib/google/apis/retail_v2alpha/classes.rb', line 5721

def rating_histogram
  @rating_histogram
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



5728
5729
5730
5731
5732
# File 'lib/google/apis/retail_v2alpha/classes.rb', line 5728

def update!(**args)
  @average_rating = args[:average_rating] if args.key?(:average_rating)
  @rating_count = args[:rating_count] if args.key?(:rating_count)
  @rating_histogram = args[:rating_histogram] if args.key?(:rating_histogram)
end