Class: WalmartApIs::SellerFeedbackType

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/seller_feedback_type.rb

Overview

Information about the seller's feedback, including the percentage of positive feedback and total ratings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(feedback_count:, seller_positive_feedback_rating: SKIP, additional_properties: nil) ⇒ SellerFeedbackType

Returns a new instance of SellerFeedbackType.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 42

def initialize(feedback_count:, seller_positive_feedback_rating: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless seller_positive_feedback_rating == SKIP
    @seller_positive_feedback_rating =
      seller_positive_feedback_rating
  end
  @feedback_count = feedback_count
  @additional_properties = additional_properties
end

Instance Attribute Details

#feedback_countInteger

The number of ratings received about the seller.

Returns:

  • (Integer)


19
20
21
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 19

def feedback_count
  @feedback_count
end

#seller_positive_feedback_ratingFloat

The percentage of positive feedback for the seller in the past 365 days.

Returns:

  • (Float)


15
16
17
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 15

def seller_positive_feedback_rating
  @seller_positive_feedback_rating
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  feedback_count = hash.key?('FeedbackCount') ? hash['FeedbackCount'] : nil
  seller_positive_feedback_rating =
    hash.key?('SellerPositiveFeedbackRating') ? hash['SellerPositiveFeedbackRating'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SellerFeedbackType.new(feedback_count: feedback_count,
                         seller_positive_feedback_rating: seller_positive_feedback_rating,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
28
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['seller_positive_feedback_rating'] =
    'SellerPositiveFeedbackRating'
  @_hash['feedback_count'] = 'FeedbackCount'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



31
32
33
34
35
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 31

def self.optionals
  %w[
    seller_positive_feedback_rating
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
90
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 85

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_positive_feedback_rating:"\
  " #{@seller_positive_feedback_rating.inspect}, feedback_count: #{@feedback_count.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/walmart_ap_is/models/seller_feedback_type.rb', line 78

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_positive_feedback_rating: #{@seller_positive_feedback_rating},"\
  " feedback_count: #{@feedback_count}, additional_properties: #{@additional_properties}>"
end