Class: WalmartApIs::CompetitivePriceType
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::CompetitivePriceType
- Defined in:
- lib/walmart_ap_is/models/competitive_price_type.rb
Overview
Schema for competitive pricing information.
Instance Attribute Summary collapse
-
#belongs_to_requester ⇒ TrueClass | FalseClass
Indicates whether the pricing information is for an offer listing that belongs to the requester.
-
#competitive_price_id ⇒ String
The pricing model for each price that is returned.
-
#condition ⇒ String
Indicates the condition of the item.
-
#offer_type ⇒ OfferType
Indicates whether the offer is a B2B or B2C offer.
-
#price ⇒ PriceType
Item price information.
-
#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.
-
#subcondition ⇒ String
Indicates the subcondition of the item.
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(competitive_price_id:, price:, condition: SKIP, subcondition: SKIP, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, belongs_to_requester: SKIP, additional_properties: nil) ⇒ CompetitivePriceType
constructor
A new instance of CompetitivePriceType.
-
#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(competitive_price_id:, price:, condition: SKIP, subcondition: SKIP, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, belongs_to_requester: SKIP, additional_properties: nil) ⇒ CompetitivePriceType
Returns a new instance of CompetitivePriceType.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 86 def initialize(competitive_price_id:, price:, condition: SKIP, subcondition: SKIP, offer_type: SKIP, quantity_tier: SKIP, quantity_discount_type: SKIP, seller_id: SKIP, belongs_to_requester: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @competitive_price_id = competitive_price_id @price = price @condition = condition unless condition == SKIP @subcondition = subcondition unless subcondition == SKIP @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 @seller_id = seller_id unless seller_id == SKIP @belongs_to_requester = belongs_to_requester unless belongs_to_requester == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#belongs_to_requester ⇒ TrueClass | FalseClass
Indicates whether the pricing information is for an offer listing that belongs to the requester.
51 52 53 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 51 def belongs_to_requester @belongs_to_requester end |
#competitive_price_id ⇒ String
The pricing model for each price that is returned. Possible values: 1 - New Buy Box Price. 2 - Used Buy Box Price.
15 16 17 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 15 def competitive_price_id @competitive_price_id end |
#condition ⇒ String
Indicates the condition of the item. Possible values: New, Used, Collectible, Refurbished, or Club.
26 27 28 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 26 def condition @condition end |
#offer_type ⇒ OfferType
Indicates whether the offer is a B2B or B2C offer.
34 35 36 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 34 def offer_type @offer_type end |
#price ⇒ PriceType
Item price information. LandedPrice = ListingPrice + Shipping. Walmart does not have a seller-configurable per-offer loyalty points mechanism; the Points field from the SP-API reference spec is omitted. See ADR-030.
21 22 23 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 21 def price @price end |
#quantity_discount_type ⇒ QuantityDiscountType
Indicates the type of quantity discount this price applies to.
42 43 44 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 42 def quantity_discount_type @quantity_discount_type end |
#quantity_tier ⇒ Integer
Indicates at what quantity this price becomes active.
38 39 40 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 38 def quantity_tier @quantity_tier end |
#seller_id ⇒ String
The seller identifier for the offer.
46 47 48 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 46 def seller_id @seller_id end |
#subcondition ⇒ String
Indicates the subcondition of the item.
30 31 32 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 30 def subcondition @subcondition end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. competitive_price_id = hash.key?('CompetitivePriceId') ? hash['CompetitivePriceId'] : nil price = PriceType.from_hash(hash['Price']) if hash['Price'] condition = hash.key?('condition') ? hash['condition'] : SKIP subcondition = hash.key?('subcondition') ? hash['subcondition'] : SKIP 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 belongs_to_requester = hash.key?('belongsToRequester') ? hash['belongsToRequester'] : 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. CompetitivePriceType.new(competitive_price_id: competitive_price_id, price: price, condition: condition, subcondition: subcondition, offer_type: offer_type, quantity_tier: quantity_tier, quantity_discount_type: quantity_discount_type, seller_id: seller_id, belongs_to_requester: belongs_to_requester, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['competitive_price_id'] = 'CompetitivePriceId' @_hash['price'] = 'Price' @_hash['condition'] = 'condition' @_hash['subcondition'] = 'subcondition' @_hash['offer_type'] = 'offerType' @_hash['quantity_tier'] = 'quantityTier' @_hash['quantity_discount_type'] = 'quantityDiscountType' @_hash['seller_id'] = 'sellerId' @_hash['belongs_to_requester'] = 'belongsToRequester' @_hash end |
.nullables ⇒ Object
An array for nullable fields
82 83 84 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 82 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 69 def self.optionals %w[ condition subcondition offer_type quantity_tier quantity_discount_type seller_id belongs_to_requester ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
154 155 156 157 158 159 160 161 162 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 154 def inspect class_name = self.class.name.split('::').last "<#{class_name} competitive_price_id: #{@competitive_price_id.inspect}, price:"\ " #{@price.inspect}, condition: #{@condition.inspect}, subcondition:"\ " #{@subcondition.inspect}, offer_type: #{@offer_type.inspect}, quantity_tier:"\ " #{@quantity_tier.inspect}, quantity_discount_type: #{@quantity_discount_type.inspect},"\ " seller_id: #{@seller_id.inspect}, belongs_to_requester: #{@belongs_to_requester.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
144 145 146 147 148 149 150 151 |
# File 'lib/walmart_ap_is/models/competitive_price_type.rb', line 144 def to_s class_name = self.class.name.split('::').last "<#{class_name} competitive_price_id: #{@competitive_price_id}, price: #{@price},"\ " condition: #{@condition}, subcondition: #{@subcondition}, offer_type: #{@offer_type},"\ " quantity_tier: #{@quantity_tier}, quantity_discount_type: #{@quantity_discount_type},"\ " seller_id: #{@seller_id}, belongs_to_requester: #{@belongs_to_requester},"\ " additional_properties: #{@additional_properties}>" end |