Class: WalmartApIs::BuyBoxPriceType
- Defined in:
- lib/walmart_ap_is/models/buy_box_price_type.rb
Overview
Schema for an individual Buy Box price.
Instance Attribute Summary collapse
-
#condition ⇒ String
Indicates the condition of the item.
-
#landed_price ⇒ MoneyType
Currency type and monetary value.
-
#listing_price ⇒ MoneyType
Currency type and monetary value.
-
#offer_type ⇒ OfferType
Indicates whether the offer is a B2B or B2C offer.
-
#quantity_discount_type ⇒ QuantityDiscountType
Indicates the type of quantity discount this price applies to.
-
#quantity_tier ⇒ Integer
Indicates at what quantity this price becomes active.
-
#seller_id ⇒ String
The seller identifier for the offer.
-
#shipping ⇒ MoneyType
Currency type and monetary value.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(condition:, landed_price:, listing_price:, shipping:, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, additional_properties: nil) ⇒ BuyBoxPriceType
constructor
A new instance of BuyBoxPriceType.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(condition:, landed_price:, listing_price:, shipping:, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, additional_properties: nil) ⇒ BuyBoxPriceType
Returns a new instance of BuyBoxPriceType.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 74 def initialize(condition:, landed_price:, listing_price:, shipping:, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @condition = condition @offer_type = offer_type unless offer_type == SKIP @quantity_tier = quantity_tier unless quantity_tier == SKIP @quantity_discount_type = quantity_discount_type unless quantity_discount_type == SKIP @landed_price = landed_price @listing_price = listing_price @shipping = shipping @seller_id = seller_id unless seller_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#condition ⇒ String
Indicates the condition of the item. For example: New, Used, Collectible, Refurbished, or Club.
15 16 17 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 15 def condition @condition end |
#landed_price ⇒ MoneyType
Currency type and monetary value.
31 32 33 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 31 def landed_price @landed_price end |
#listing_price ⇒ MoneyType
Currency type and monetary value.
35 36 37 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 35 def listing_price @listing_price end |
#offer_type ⇒ OfferType
Indicates whether the offer is a B2B or B2C offer.
19 20 21 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 19 def offer_type @offer_type end |
#quantity_discount_type ⇒ QuantityDiscountType
Indicates the type of quantity discount this price applies to.
27 28 29 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 27 def quantity_discount_type @quantity_discount_type end |
#quantity_tier ⇒ Integer
Indicates at what quantity this price becomes active.
23 24 25 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 23 def quantity_tier @quantity_tier end |
#seller_id ⇒ String
The seller identifier for the offer.
43 44 45 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 43 def seller_id @seller_id end |
#shipping ⇒ MoneyType
Currency type and monetary value.
39 40 41 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 39 def shipping @shipping end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. condition = hash.key?('condition') ? hash['condition'] : nil landed_price = MoneyType.from_hash(hash['LandedPrice']) if hash['LandedPrice'] listing_price = MoneyType.from_hash(hash['ListingPrice']) if hash['ListingPrice'] shipping = MoneyType.from_hash(hash['Shipping']) if hash['Shipping'] offer_type = hash.key?('offerType') ? hash['offerType'] : SKIP quantity_tier = hash.key?('quantityTier') ? hash['quantityTier'] : SKIP quantity_discount_type = hash.key?('quantityDiscountType') ? hash['quantityDiscountType'] : SKIP seller_id = hash.key?('sellerId') ? hash['sellerId'] : 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. BuyBoxPriceType.new(condition: condition, landed_price: landed_price, listing_price: listing_price, shipping: shipping, offer_type: offer_type, quantity_tier: quantity_tier, quantity_discount_type: quantity_discount_type, seller_id: seller_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['condition'] = 'condition' @_hash['offer_type'] = 'offerType' @_hash['quantity_tier'] = 'quantityTier' @_hash['quantity_discount_type'] = 'quantityDiscountType' @_hash['landed_price'] = 'LandedPrice' @_hash['listing_price'] = 'ListingPrice' @_hash['shipping'] = 'Shipping' @_hash['seller_id'] = 'sellerId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 60 def self.optionals %w[ offer_type quantity_tier quantity_discount_type seller_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
136 137 138 139 140 141 142 143 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 136 def inspect class_name = self.class.name.split('::').last "<#{class_name} condition: #{@condition.inspect}, offer_type: #{@offer_type.inspect},"\ " quantity_tier: #{@quantity_tier.inspect}, quantity_discount_type:"\ " #{@quantity_discount_type.inspect}, landed_price: #{@landed_price.inspect}, listing_price:"\ " #{@listing_price.inspect}, shipping: #{@shipping.inspect}, seller_id:"\ " #{@seller_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
127 128 129 130 131 132 133 |
# File 'lib/walmart_ap_is/models/buy_box_price_type.rb', line 127 def to_s class_name = self.class.name.split('::').last "<#{class_name} condition: #{@condition}, offer_type: #{@offer_type}, quantity_tier:"\ " #{@quantity_tier}, quantity_discount_type: #{@quantity_discount_type}, landed_price:"\ " #{@landed_price}, listing_price: #{@listing_price}, shipping: #{@shipping}, seller_id:"\ " #{@seller_id}, additional_properties: #{@additional_properties}>" end |