Class: WalmartApIs::Shipment
- Defined in:
- lib/walmart_ap_is/models/shipment.rb
Overview
Contains information pertaining to a shipment in an inbound plan.
Instance Attribute Summary collapse
-
#contact_information ⇒ ContactInformation
The seller's contact information.
-
#dates ⇒ Dates
Specifies the date that the seller expects their shipment will be shipped.
-
#destination ⇒ ShipmentDestination
The Walmart Ship Node address and warehouse ID.
-
#freight_information ⇒ FreightInformation
Freight information describes the SKUs that are in transit.
-
#name ⇒ String
The name of the shipment.
-
#placement_option_id ⇒ String
The identifier of a placement option.
-
#selected_delivery_window ⇒ SelectedDeliveryWindow
Selected delivery window attributes.
-
#selected_transportation_option_id ⇒ String
Identifier of a transportation option.
-
#self_ship_appointment_details ⇒ Array[SelfShipAppointmentDetails]
List of self ship appointment details.
-
#shipment_confirmation_id ⇒ String
The confirmed shipment ID which shows up on labels.
-
#shipment_id ⇒ String
Identifier of a shipment.
-
#source ⇒ ShipmentSource
Specifies the 'ship from' address for the shipment.
-
#status ⇒ String
The status of a shipment.
-
#tracking_details ⇒ TrackingDetails
Tracking information for LTL and SPD shipments.
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:, placement_option_id:, shipment_id:, source:, contact_information: SKIP, dates: SKIP, freight_information: SKIP, name: SKIP, selected_delivery_window: SKIP, selected_transportation_option_id: SKIP, self_ship_appointment_details: SKIP, shipment_confirmation_id: SKIP, status: SKIP, tracking_details: SKIP, additional_properties: nil) ⇒ Shipment
constructor
A new instance of Shipment.
-
#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:, placement_option_id:, shipment_id:, source:, contact_information: SKIP, dates: SKIP, freight_information: SKIP, name: SKIP, selected_delivery_window: SKIP, selected_transportation_option_id: SKIP, self_ship_appointment_details: SKIP, shipment_confirmation_id: SKIP, status: SKIP, tracking_details: SKIP, additional_properties: nil) ⇒ Shipment
Returns a new instance of Shipment.
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 142 143 144 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 112 def initialize(destination:, placement_option_id:, shipment_id:, source:, contact_information: SKIP, dates: SKIP, freight_information: SKIP, name: SKIP, selected_delivery_window: SKIP, selected_transportation_option_id: SKIP, self_ship_appointment_details: SKIP, shipment_confirmation_id: SKIP, status: SKIP, tracking_details: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @contact_information = contact_information unless contact_information == SKIP @dates = dates unless dates == SKIP @destination = destination @freight_information = freight_information unless freight_information == SKIP @name = name unless name == SKIP @placement_option_id = placement_option_id @selected_delivery_window = selected_delivery_window unless selected_delivery_window == SKIP unless selected_transportation_option_id == SKIP @selected_transportation_option_id = selected_transportation_option_id end unless self_ship_appointment_details == SKIP @self_ship_appointment_details = self_ship_appointment_details end @shipment_confirmation_id = shipment_confirmation_id unless shipment_confirmation_id == SKIP @shipment_id = shipment_id @source = source @status = status unless status == SKIP @tracking_details = tracking_details unless tracking_details == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#contact_information ⇒ ContactInformation
The seller's contact information.
14 15 16 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 14 def contact_information @contact_information end |
#dates ⇒ Dates
Specifies the date that the seller expects their shipment will be shipped.
18 19 20 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 18 def dates @dates end |
#destination ⇒ ShipmentDestination
The Walmart Ship Node address and warehouse ID.
22 23 24 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 22 def destination @destination end |
#freight_information ⇒ FreightInformation
Freight information describes the SKUs that are in transit.
26 27 28 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 26 def freight_information @freight_information end |
#name ⇒ String
The name of the shipment.
30 31 32 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 30 def name @name end |
#placement_option_id ⇒ String
The identifier of a placement option.
34 35 36 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 34 def placement_option_id @placement_option_id end |
#selected_delivery_window ⇒ SelectedDeliveryWindow
Selected delivery window attributes.
38 39 40 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 38 def selected_delivery_window @selected_delivery_window end |
#selected_transportation_option_id ⇒ String
Identifier of a transportation option.
42 43 44 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 42 def selected_transportation_option_id @selected_transportation_option_id end |
#self_ship_appointment_details ⇒ Array[SelfShipAppointmentDetails]
List of self ship appointment details.
46 47 48 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 46 def self_ship_appointment_details @self_ship_appointment_details end |
#shipment_confirmation_id ⇒ String
The confirmed shipment ID which shows up on labels.
50 51 52 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 50 def shipment_confirmation_id @shipment_confirmation_id end |
#shipment_id ⇒ String
Identifier of a shipment.
54 55 56 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 54 def shipment_id @shipment_id end |
#source ⇒ ShipmentSource
Specifies the 'ship from' address for the shipment.
58 59 60 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 58 def source @source end |
#status ⇒ String
The status of a shipment. Possible values: ABANDONED, CANCELLED,
CHECKED_IN, CLOSED, DELETED, DELIVERED, IN_TRANSIT, MIXED,
READY_TO_SHIP, RECEIVING, SHIPPED, UNCONFIRMED, WORKING.
64 65 66 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 64 def status @status end |
#tracking_details ⇒ TrackingDetails
Tracking information for LTL and SPD shipments.
68 69 70 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 68 def tracking_details @tracking_details end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 147 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. destination = ShipmentDestination.from_hash(hash['destination']) if hash['destination'] placement_option_id = hash.key?('placementOptionId') ? hash['placementOptionId'] : nil shipment_id = hash.key?('shipmentId') ? hash['shipmentId'] : nil source = ShipmentSource.from_hash(hash['source']) if hash['source'] contact_information = ContactInformation.from_hash(hash['contactInformation']) if hash['contactInformation'] dates = Dates.from_hash(hash['dates']) if hash['dates'] freight_information = FreightInformation.from_hash(hash['freightInformation']) if hash['freightInformation'] name = hash.key?('name') ? hash['name'] : SKIP selected_delivery_window = SelectedDeliveryWindow.from_hash(hash['selectedDeliveryWindow']) if hash['selectedDeliveryWindow'] selected_transportation_option_id = hash.key?('selectedTransportationOptionId') ? hash['selectedTransportationOptionId'] : SKIP # Parameter is an array, so we need to iterate through it self_ship_appointment_details = nil unless hash['selfShipAppointmentDetails'].nil? self_ship_appointment_details = [] hash['selfShipAppointmentDetails'].each do |structure| self_ship_appointment_details << (SelfShipAppointmentDetails.from_hash(structure) if structure) end end self_ship_appointment_details = SKIP unless hash.key?('selfShipAppointmentDetails') shipment_confirmation_id = hash.key?('shipmentConfirmationId') ? hash['shipmentConfirmationId'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP tracking_details = TrackingDetails.from_hash(hash['trackingDetails']) if hash['trackingDetails'] # 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. Shipment.new(destination: destination, placement_option_id: placement_option_id, shipment_id: shipment_id, source: source, contact_information: contact_information, dates: dates, freight_information: freight_information, name: name, selected_delivery_window: selected_delivery_window, selected_transportation_option_id: selected_transportation_option_id, self_ship_appointment_details: self_ship_appointment_details, shipment_confirmation_id: shipment_confirmation_id, status: status, tracking_details: tracking_details, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 71 def self.names @_hash = {} if @_hash.nil? @_hash['contact_information'] = 'contactInformation' @_hash['dates'] = 'dates' @_hash['destination'] = 'destination' @_hash['freight_information'] = 'freightInformation' @_hash['name'] = 'name' @_hash['placement_option_id'] = 'placementOptionId' @_hash['selected_delivery_window'] = 'selectedDeliveryWindow' @_hash['selected_transportation_option_id'] = 'selectedTransportationOptionId' @_hash['self_ship_appointment_details'] = 'selfShipAppointmentDetails' @_hash['shipment_confirmation_id'] = 'shipmentConfirmationId' @_hash['shipment_id'] = 'shipmentId' @_hash['source'] = 'source' @_hash['status'] = 'status' @_hash['tracking_details'] = 'trackingDetails' @_hash end |
.nullables ⇒ Object
An array for nullable fields
108 109 110 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 108 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 92 def self.optionals %w[ contact_information dates freight_information name selected_delivery_window selected_transportation_option_id self_ship_appointment_details shipment_confirmation_id status tracking_details ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 221 def inspect class_name = self.class.name.split('::').last "<#{class_name} contact_information: #{@contact_information.inspect}, dates:"\ " #{@dates.inspect}, destination: #{@destination.inspect}, freight_information:"\ " #{@freight_information.inspect}, name: #{@name.inspect}, placement_option_id:"\ " #{@placement_option_id.inspect}, selected_delivery_window:"\ " #{@selected_delivery_window.inspect}, selected_transportation_option_id:"\ " #{@selected_transportation_option_id.inspect}, self_ship_appointment_details:"\ " #{@self_ship_appointment_details.inspect}, shipment_confirmation_id:"\ " #{@shipment_confirmation_id.inspect}, shipment_id: #{@shipment_id.inspect}, source:"\ " #{@source.inspect}, status: #{@status.inspect}, tracking_details:"\ " #{@tracking_details.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/walmart_ap_is/models/shipment.rb', line 208 def to_s class_name = self.class.name.split('::').last "<#{class_name} contact_information: #{@contact_information}, dates: #{@dates},"\ " destination: #{@destination}, freight_information: #{@freight_information}, name:"\ " #{@name}, placement_option_id: #{@placement_option_id}, selected_delivery_window:"\ " #{@selected_delivery_window}, selected_transportation_option_id:"\ " #{@selected_transportation_option_id}, self_ship_appointment_details:"\ " #{@self_ship_appointment_details}, shipment_confirmation_id: #{@shipment_confirmation_id},"\ " shipment_id: #{@shipment_id}, source: #{@source}, status: #{@status}, tracking_details:"\ " #{@tracking_details}, additional_properties: #{@additional_properties}>" end |