Class: WalmartApIs::TransportationSelection
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::TransportationSelection
- Defined in:
- lib/walmart_ap_is/models/transportation_selection.rb
Overview
The transportation option selected to confirm.
Instance Attribute Summary collapse
-
#contact_information ⇒ ContactInformation
The seller's contact information.
-
#shipment_id ⇒ String
Shipment ID that the transportation option is for.
-
#transportation_option_id ⇒ String
Transportation option being selected for the provided shipment.
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(shipment_id:, transportation_option_id:, contact_information: SKIP, additional_properties: nil) ⇒ TransportationSelection
constructor
A new instance of TransportationSelection.
-
#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(shipment_id:, transportation_option_id:, contact_information: SKIP, additional_properties: nil) ⇒ TransportationSelection
Returns a new instance of TransportationSelection.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 45 def initialize(shipment_id:, transportation_option_id:, contact_information: 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 @shipment_id = shipment_id @transportation_option_id = transportation_option_id @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/transportation_selection.rb', line 14 def contact_information @contact_information end |
#shipment_id ⇒ String
Shipment ID that the transportation option is for.
18 19 20 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 18 def shipment_id @shipment_id end |
#transportation_option_id ⇒ String
Transportation option being selected for the provided shipment.
22 23 24 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 22 def transportation_option_id @transportation_option_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. shipment_id = hash.key?('shipmentId') ? hash['shipmentId'] : nil transportation_option_id = hash.key?('transportationOptionId') ? hash['transportationOptionId'] : nil contact_information = ContactInformation.from_hash(hash['contactInformation']) if hash['contactInformation'] # 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. TransportationSelection.new(shipment_id: shipment_id, transportation_option_id: transportation_option_id, contact_information: contact_information, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['contact_information'] = 'contactInformation' @_hash['shipment_id'] = 'shipmentId' @_hash['transportation_option_id'] = 'transportationOptionId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 34 def self.optionals %w[ contact_information ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
90 91 92 93 94 95 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 90 def inspect class_name = self.class.name.split('::').last "<#{class_name} contact_information: #{@contact_information.inspect}, shipment_id:"\ " #{@shipment_id.inspect}, transportation_option_id: #{@transportation_option_id.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 87 |
# File 'lib/walmart_ap_is/models/transportation_selection.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} contact_information: #{@contact_information}, shipment_id: #{@shipment_id},"\ " transportation_option_id: #{@transportation_option_id}, additional_properties:"\ " #{@additional_properties}>" end |