Class: WalmartApIs::CompetitiveSummaryResponseBody

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

Overview

The body of a competitive summary response.

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(walmart_item_id: SKIP, marketplace_id: SKIP, featured_buying_options: SKIP, lowest_priced_offers: SKIP, reference_prices: SKIP, additional_properties: nil) ⇒ CompetitiveSummaryResponseBody

Returns a new instance of CompetitiveSummaryResponseBody.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 59

def initialize(walmart_item_id: SKIP, marketplace_id: SKIP,
               featured_buying_options: SKIP, lowest_priced_offers: SKIP,
               reference_prices: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @walmart_item_id = walmart_item_id unless walmart_item_id == SKIP
  @marketplace_id = marketplace_id unless marketplace_id == SKIP
  @featured_buying_options = featured_buying_options unless featured_buying_options == SKIP
  @lowest_priced_offers = lowest_priced_offers unless lowest_priced_offers == SKIP
  @reference_prices = reference_prices unless reference_prices == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

A list of featured buying options.

Returns:

  • (Array[Object])


22
23
24
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 22

def featured_buying_options
  @featured_buying_options
end

#lowest_priced_offersArray[Object]

A list of lowest priced offers by condition.

Returns:

  • (Array[Object])


26
27
28
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 26

def lowest_priced_offers
  @lowest_priced_offers
end

#marketplace_idString

A marketplace identifier.

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 18

def marketplace_id
  @marketplace_id
end

#reference_pricesArray[Object]

A list of reference prices.

Returns:

  • (Array[Object])


30
31
32
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 30

def reference_prices
  @reference_prices
end

#walmart_item_idString

The Walmart Item ID of the item.

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 14

def walmart_item_id
  @walmart_item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  walmart_item_id =
    hash.key?('walmartItemId') ? hash['walmartItemId'] : SKIP
  marketplace_id = hash.key?('marketplaceId') ? hash['marketplaceId'] : SKIP
  featured_buying_options =
    hash.key?('featuredBuyingOptions') ? hash['featuredBuyingOptions'] : SKIP
  lowest_priced_offers =
    hash.key?('lowestPricedOffers') ? hash['lowestPricedOffers'] : SKIP
  reference_prices =
    hash.key?('referencePrices') ? hash['referencePrices'] : 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.
  CompetitiveSummaryResponseBody.new(walmart_item_id: walmart_item_id,
                                     marketplace_id: marketplace_id,
                                     featured_buying_options: featured_buying_options,
                                     lowest_priced_offers: lowest_priced_offers,
                                     reference_prices: reference_prices,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['walmart_item_id'] = 'walmartItemId'
  @_hash['marketplace_id'] = 'marketplaceId'
  @_hash['featured_buying_options'] = 'featuredBuyingOptions'
  @_hash['lowest_priced_offers'] = 'lowestPricedOffers'
  @_hash['reference_prices'] = 'referencePrices'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    walmart_item_id
    marketplace_id
    featured_buying_options
    lowest_priced_offers
    reference_prices
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
120
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 114

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} walmart_item_id: #{@walmart_item_id.inspect}, marketplace_id:"\
  " #{@marketplace_id.inspect}, featured_buying_options: #{@featured_buying_options.inspect},"\
  " lowest_priced_offers: #{@lowest_priced_offers.inspect}, reference_prices:"\
  " #{@reference_prices.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
111
# File 'lib/walmart_ap_is/models/competitive_summary_response_body.rb', line 105

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} walmart_item_id: #{@walmart_item_id}, marketplace_id: #{@marketplace_id},"\
  " featured_buying_options: #{@featured_buying_options}, lowest_priced_offers:"\
  " #{@lowest_priced_offers}, reference_prices: #{@reference_prices}, additional_properties:"\
  " #{@additional_properties}>"
end