Class: WalmartApIs::CreateInboundPlanRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::CreateInboundPlanRequest
- Defined in:
- lib/walmart_ap_is/models/create_inbound_plan_request.rb
Overview
The createInboundPlan request.
Instance Attribute Summary collapse
-
#destination_marketplaces ⇒ Array[String]
Walmart Marketplace IDs where the items need to be shipped to.
-
#items ⇒ Array[ItemInput]
Items included in this plan.
-
#name ⇒ String
Name for the Inbound Plan.
-
#source_address ⇒ AddressInput
Specific details to identify a place (input variant — phone required).
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(destination_marketplaces:, items:, source_address:, name: SKIP, additional_properties: nil) ⇒ CreateInboundPlanRequest
constructor
A new instance of CreateInboundPlanRequest.
-
#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(destination_marketplaces:, items:, source_address:, name: SKIP, additional_properties: nil) ⇒ CreateInboundPlanRequest
Returns a new instance of CreateInboundPlanRequest.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 52 def initialize(destination_marketplaces:, items:, source_address:, name: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @destination_marketplaces = destination_marketplaces @items = items @name = name unless name == SKIP @source_address = source_address @additional_properties = additional_properties end |
Instance Attribute Details
#destination_marketplaces ⇒ Array[String]
Walmart Marketplace IDs where the items need to be shipped to. Currently only one marketplace can be selected.
15 16 17 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 15 def destination_marketplaces @destination_marketplaces end |
#items ⇒ Array[ItemInput]
Items included in this plan.
19 20 21 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 19 def items @items end |
#name ⇒ String
Name for the Inbound Plan. If one isn't provided, a default name will be provided.
24 25 26 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 24 def name @name end |
#source_address ⇒ AddressInput
Specific details to identify a place (input variant — phone required).
28 29 30 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 28 def source_address @source_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 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 97 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. destination_marketplaces = hash.key?('destinationMarketplaces') ? hash['destinationMarketplaces'] : nil # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (ItemInput.from_hash(structure) if structure) end end items = nil unless hash.key?('items') source_address = AddressInput.from_hash(hash['sourceAddress']) if hash['sourceAddress'] name = hash.key?('name') ? hash['name'] : 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. CreateInboundPlanRequest.new(destination_marketplaces: destination_marketplaces, items: items, source_address: source_address, name: name, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['destination_marketplaces'] = 'destinationMarketplaces' @_hash['items'] = 'items' @_hash['name'] = 'name' @_hash['source_address'] = 'sourceAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 41 def self.optionals %w[ name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
108 109 110 111 112 113 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 108 def inspect class_name = self.class.name.split('::').last "<#{class_name} destination_marketplaces: #{@destination_marketplaces.inspect}, items:"\ " #{@items.inspect}, name: #{@name.inspect}, source_address: #{@source_address.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
100 101 102 103 104 105 |
# File 'lib/walmart_ap_is/models/create_inbound_plan_request.rb', line 100 def to_s class_name = self.class.name.split('::').last "<#{class_name} destination_marketplaces: #{@destination_marketplaces}, items: #{@items},"\ " name: #{@name}, source_address: #{@source_address}, additional_properties:"\ " #{@additional_properties}>" end |