Class: WalmartApIs::MarketplaceOrderDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::MarketplaceOrderDetails
- Defined in:
- lib/walmart_ap_is/models/marketplace_order_details.rb
Overview
Marketplace-side order context for orders originating on the Walmart Marketplace surface. Equivalent in shape to industry SP-API's order-details block; renamed to be vendor-neutral.
Instance Attribute Summary collapse
-
#order_date ⇒ DateTime
TODO: Write general description for this method.
-
#order_id ⇒ String
TODO: Write general description for this method.
-
#purchase_order_id ⇒ String
Walmart Purchase Order ID.
-
#seller_id ⇒ String
TODO: Write general description for this method.
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(order_id: SKIP, order_date: SKIP, seller_id: SKIP, purchase_order_id: SKIP, additional_properties: nil) ⇒ MarketplaceOrderDetails
constructor
A new instance of MarketplaceOrderDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_order_date ⇒ Object
-
#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(order_id: SKIP, order_date: SKIP, seller_id: SKIP, purchase_order_id: SKIP, additional_properties: nil) ⇒ MarketplaceOrderDetails
Returns a new instance of MarketplaceOrderDetails.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 56 def initialize(order_id: SKIP, order_date: SKIP, seller_id: SKIP, purchase_order_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @order_id = order_id unless order_id == SKIP @order_date = order_date unless order_date == SKIP @seller_id = seller_id unless seller_id == SKIP @purchase_order_id = purchase_order_id unless purchase_order_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#order_date ⇒ DateTime
TODO: Write general description for this method
21 22 23 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 21 def order_date @order_date end |
#order_id ⇒ String
TODO: Write general description for this method
17 18 19 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 17 def order_id @order_id end |
#purchase_order_id ⇒ String
Walmart Purchase Order ID
29 30 31 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 29 def purchase_order_id @purchase_order_id end |
#seller_id ⇒ String
TODO: Write general description for this method
25 26 27 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 25 def seller_id @seller_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. order_id = hash.key?('orderId') ? hash['orderId'] : SKIP order_date = if hash.key?('orderDate') (DateTimeHelper.from_rfc3339(hash['orderDate']) if hash['orderDate']) else SKIP end seller_id = hash.key?('sellerId') ? hash['sellerId'] : SKIP purchase_order_id = hash.key?('purchaseOrderId') ? hash['purchaseOrderId'] : 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. MarketplaceOrderDetails.new(order_id: order_id, order_date: order_date, seller_id: seller_id, purchase_order_id: purchase_order_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 39 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['order_id'] = 'orderId' @_hash['order_date'] = 'orderDate' @_hash['seller_id'] = 'sellerId' @_hash['purchase_order_id'] = 'purchaseOrderId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 45 46 47 48 49 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 42 def self.optionals %w[ order_id order_date seller_id purchase_order_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} order_id: #{@order_id.inspect}, order_date: #{@order_date.inspect},"\ " seller_id: #{@seller_id.inspect}, purchase_order_id: #{@purchase_order_id.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_order_date ⇒ Object
98 99 100 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 98 def to_custom_order_date DateTimeHelper.to_rfc3339(order_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 |
# File 'lib/walmart_ap_is/models/marketplace_order_details.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} order_id: #{@order_id}, order_date: #{@order_date}, seller_id:"\ " #{@seller_id}, purchase_order_id: #{@purchase_order_id}, additional_properties:"\ " #{@additional_properties}>" end |