Class: WalmartApIs::ItemInput
- Defined in:
- lib/walmart_ap_is/models/item_input.rb
Overview
Defines an item's input parameters.
Instance Attribute Summary collapse
-
#expiration ⇒ String
The expiration date of the MSKU.
-
#label_owner ⇒ LabelOwner
Specifies who will label the items.
-
#manufacturing_lot_code ⇒ String
The manufacturing lot code.
-
#msku ⇒ String
The merchant SKU, a merchant-supplied identifier of a specific SKU.
-
#prep_owner ⇒ PrepOwner
The owner of the preparations, if special preparations are required.
-
#quantity ⇒ Integer
The number of units of the specified MSKU that will be shipped.
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(label_owner:, msku:, prep_owner:, quantity:, expiration: SKIP, manufacturing_lot_code: SKIP, additional_properties: nil) ⇒ ItemInput
constructor
A new instance of ItemInput.
-
#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(label_owner:, msku:, prep_owner:, quantity:, expiration: SKIP, manufacturing_lot_code: SKIP, additional_properties: nil) ⇒ ItemInput
Returns a new instance of ItemInput.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 63 def initialize(label_owner:, msku:, prep_owner:, quantity:, expiration: SKIP, manufacturing_lot_code: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @expiration = expiration unless expiration == SKIP @label_owner = label_owner @manufacturing_lot_code = manufacturing_lot_code unless manufacturing_lot_code == SKIP @msku = msku @prep_owner = prep_owner @quantity = quantity @additional_properties = additional_properties end |
Instance Attribute Details
#expiration ⇒ String
The expiration date of the MSKU. In ISO 8601 date format with pattern
YYYY-MM-DD. Items with the same MSKU but different expiration dates
cannot go into the same box.
16 17 18 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 16 def expiration @expiration end |
#label_owner ⇒ LabelOwner
Specifies who will label the items. Options include SELLER and NONE.
20 21 22 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 20 def label_owner @label_owner end |
#manufacturing_lot_code ⇒ String
The manufacturing lot code.
24 25 26 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 24 def manufacturing_lot_code @manufacturing_lot_code end |
#msku ⇒ String
The merchant SKU, a merchant-supplied identifier of a specific SKU.
28 29 30 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 28 def msku @msku end |
#prep_owner ⇒ PrepOwner
The owner of the preparations, if special preparations are required.
32 33 34 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 32 def prep_owner @prep_owner end |
#quantity ⇒ Integer
The number of units of the specified MSKU that will be shipped.
36 37 38 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 36 def quantity @quantity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. label_owner = hash.key?('labelOwner') ? hash['labelOwner'] : nil msku = hash.key?('msku') ? hash['msku'] : nil prep_owner = hash.key?('prepOwner') ? hash['prepOwner'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil expiration = hash.key?('expiration') ? hash['expiration'] : SKIP manufacturing_lot_code = hash.key?('manufacturingLotCode') ? hash['manufacturingLotCode'] : 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. ItemInput.new(label_owner: label_owner, msku: msku, prep_owner: prep_owner, quantity: quantity, expiration: expiration, manufacturing_lot_code: manufacturing_lot_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['expiration'] = 'expiration' @_hash['label_owner'] = 'labelOwner' @_hash['manufacturing_lot_code'] = 'manufacturingLotCode' @_hash['msku'] = 'msku' @_hash['prep_owner'] = 'prepOwner' @_hash['quantity'] = 'quantity' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 51 def self.optionals %w[ expiration manufacturing_lot_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
117 118 119 120 121 122 123 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 117 def inspect class_name = self.class.name.split('::').last "<#{class_name} expiration: #{@expiration.inspect}, label_owner: #{@label_owner.inspect},"\ " manufacturing_lot_code: #{@manufacturing_lot_code.inspect}, msku: #{@msku.inspect},"\ " prep_owner: #{@prep_owner.inspect}, quantity: #{@quantity.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
109 110 111 112 113 114 |
# File 'lib/walmart_ap_is/models/item_input.rb', line 109 def to_s class_name = self.class.name.split('::').last "<#{class_name} expiration: #{@expiration}, label_owner: #{@label_owner},"\ " manufacturing_lot_code: #{@manufacturing_lot_code}, msku: #{@msku}, prep_owner:"\ " #{@prep_owner}, quantity: #{@quantity}, additional_properties: #{@additional_properties}>" end |