Class: WalmartApIs::WfsItemInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::WfsItemInformation
- Defined in:
- lib/walmart_ap_is/models/wfs_item_information.rb
Overview
WfsItemInformation Model.
Instance Attribute Summary collapse
-
#brand ⇒ String
Item title as listed on Walmart.com (SP-API aligned).
-
#condition ⇒ Condition1
Item condition (SP-API aligned).
-
#gtin ⇒ String
Global Trade Item Number (14-digit).
-
#offer_id ⇒ String
Walmart offer ID.
-
#product_name ⇒ String
Item title as listed on Walmart.com (SP-API aligned).
-
#seller_sku ⇒ String
Seller-assigned SKU identifier (SP-API aligned).
-
#walmart_item_id ⇒ String
Walmart internal item ID.
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(seller_sku:, walmart_item_id: SKIP, gtin: SKIP, offer_id: SKIP, product_name: SKIP, brand: SKIP, condition: SKIP, additional_properties: nil) ⇒ WfsItemInformation
constructor
A new instance of WfsItemInformation.
-
#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(seller_sku:, walmart_item_id: SKIP, gtin: SKIP, offer_id: SKIP, product_name: SKIP, brand: SKIP, condition: SKIP, additional_properties: nil) ⇒ WfsItemInformation
Returns a new instance of WfsItemInformation.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 70 def initialize(seller_sku:, walmart_item_id: SKIP, gtin: SKIP, offer_id: SKIP, product_name: SKIP, brand: SKIP, condition: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @seller_sku = seller_sku @walmart_item_id = walmart_item_id unless walmart_item_id == SKIP @gtin = gtin unless gtin == SKIP @offer_id = offer_id unless offer_id == SKIP @product_name = product_name unless product_name == SKIP @brand = brand unless brand == SKIP @condition = condition unless condition == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#brand ⇒ String
Item title as listed on Walmart.com (SP-API aligned)
34 35 36 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 34 def brand @brand end |
#condition ⇒ Condition1
Item condition (SP-API aligned)
38 39 40 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 38 def condition @condition end |
#gtin ⇒ String
Global Trade Item Number (14-digit)
22 23 24 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 22 def gtin @gtin end |
#offer_id ⇒ String
Walmart offer ID
26 27 28 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 26 def offer_id @offer_id end |
#product_name ⇒ String
Item title as listed on Walmart.com (SP-API aligned)
30 31 32 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 30 def product_name @product_name end |
#seller_sku ⇒ String
Seller-assigned SKU identifier (SP-API aligned)
14 15 16 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 14 def seller_sku @seller_sku end |
#walmart_item_id ⇒ String
Walmart internal item ID
18 19 20 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 18 def walmart_item_id @walmart_item_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. seller_sku = hash.key?('sellerSku') ? hash['sellerSku'] : nil walmart_item_id = hash.key?('walmartItemId') ? hash['walmartItemId'] : SKIP gtin = hash.key?('gtin') ? hash['gtin'] : SKIP offer_id = hash.key?('offerId') ? hash['offerId'] : SKIP product_name = hash.key?('productName') ? hash['productName'] : SKIP brand = hash.key?('brand') ? hash['brand'] : SKIP condition = hash.key?('condition') ? hash['condition'] : 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. WfsItemInformation.new(seller_sku: seller_sku, walmart_item_id: walmart_item_id, gtin: gtin, offer_id: offer_id, product_name: product_name, brand: brand, condition: condition, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['seller_sku'] = 'sellerSku' @_hash['walmart_item_id'] = 'walmartItemId' @_hash['gtin'] = 'gtin' @_hash['offer_id'] = 'offerId' @_hash['product_name'] = 'productName' @_hash['brand'] = 'brand' @_hash['condition'] = 'condition' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 54 def self.optionals %w[ walmart_item_id gtin offer_id product_name brand condition ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 133 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} seller_sku: #{@seller_sku.inspect}, walmart_item_id:"\ " #{@walmart_item_id.inspect}, gtin: #{@gtin.inspect}, offer_id: #{@offer_id.inspect},"\ " product_name: #{@product_name.inspect}, brand: #{@brand.inspect}, condition:"\ " #{@condition.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 |
# File 'lib/walmart_ap_is/models/wfs_item_information.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} seller_sku: #{@seller_sku}, walmart_item_id: #{@walmart_item_id}, gtin:"\ " #{@gtin}, offer_id: #{@offer_id}, product_name: #{@product_name}, brand: #{@brand},"\ " condition: #{@condition}, additional_properties: #{@additional_properties}>" end |