Class: WalmartApIs::FreightInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::FreightInformation
- Defined in:
- lib/walmart_ap_is/models/freight_information.rb
Overview
Freight information describes the SKUs that are in transit.
Instance Attribute Summary collapse
-
#declared_value ⇒ Currency
The type and amount of currency.
-
#freight_class ⇒ String
Freight class.
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(declared_value: SKIP, freight_class: SKIP, additional_properties: nil) ⇒ FreightInformation
constructor
A new instance of FreightInformation.
-
#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(declared_value: SKIP, freight_class: SKIP, additional_properties: nil) ⇒ FreightInformation
Returns a new instance of FreightInformation.
44 45 46 47 48 49 50 51 52 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 44 def initialize(declared_value: SKIP, freight_class: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @declared_value = declared_value unless declared_value == SKIP @freight_class = freight_class unless freight_class == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#declared_value ⇒ Currency
The type and amount of currency.
14 15 16 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 14 def declared_value @declared_value end |
#freight_class ⇒ String
Freight class. Possible values: NONE, FC_50, FC_55, FC_60,
FC_65, FC_70, FC_77_5, FC_85, FC_92_5, FC_100, FC_110,
FC_125, FC_150, FC_175, FC_200, FC_250, FC_300, FC_400,
FC_500.
21 22 23 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 21 def freight_class @freight_class end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. declared_value = Currency.from_hash(hash['declaredValue']) if hash['declaredValue'] freight_class = hash.key?('freightClass') ? hash['freightClass'] : 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. FreightInformation.new(declared_value: declared_value, freight_class: freight_class, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['declared_value'] = 'declaredValue' @_hash['freight_class'] = 'freightClass' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 32 def self.optionals %w[ declared_value freight_class ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
83 84 85 86 87 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 83 def inspect class_name = self.class.name.split('::').last "<#{class_name} declared_value: #{@declared_value.inspect}, freight_class:"\ " #{@freight_class.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
76 77 78 79 80 |
# File 'lib/walmart_ap_is/models/freight_information.rb', line 76 def to_s class_name = self.class.name.split('::').last "<#{class_name} declared_value: #{@declared_value}, freight_class: #{@freight_class},"\ " additional_properties: #{@additional_properties}>" end |