Class: TqlOtrFactoringDataExchange::InvoiceItemInput
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::InvoiceItemInput
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb
Overview
A physical line item on the invoice describing a commodity or handling unit being shipped. Items represent the freight itself — what was physically moved — as opposed to charges, which represent the monetary billing. Including item details enables freight audit and rate verification.
Instance Attribute Summary collapse
-
#description ⇒ String
Free-text description of the commodity or goods.
-
#freight_class ⇒ Float
NMFC freight class (e.g., 50, 55, 60, 65, 70, 77.5, 85, 92.5, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500).
-
#handling_unit ⇒ String
Type of handling unit.
-
#handling_unit_count ⇒ Integer
Number of handling units for this line item.
-
#item_id ⇒ String
Caller-assigned identifier for this item.
-
#weight ⇒ Float
Weight of this line item.
-
#weight_unit ⇒ WeightUnit
Unit of measure for ‘weight`.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(item_id:, description: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, weight: SKIP, weight_unit: WeightUnit::LBS, freight_class: SKIP, additional_properties: nil) ⇒ InvoiceItemInput
constructor
A new instance of InvoiceItemInput.
-
#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(item_id:, description: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, weight: SKIP, weight_unit: WeightUnit::LBS, freight_class: SKIP, additional_properties: nil) ⇒ InvoiceItemInput
Returns a new instance of InvoiceItemInput.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 83 def initialize(item_id:, description: SKIP, handling_unit: SKIP, handling_unit_count: SKIP, weight: SKIP, weight_unit: WeightUnit::LBS, freight_class: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id @description = description unless description == SKIP @handling_unit = handling_unit unless handling_unit == SKIP @handling_unit_count = handling_unit_count unless handling_unit_count == SKIP @weight = weight unless weight == SKIP @weight_unit = weight_unit unless weight_unit == SKIP @freight_class = freight_class unless freight_class == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
Free-text description of the commodity or goods.
22 23 24 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 22 def description @description end |
#freight_class ⇒ Float
NMFC freight class (e.g., 50, 55, 60, 65, 70, 77.5, 85, 92.5, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500). Used for LTL rating and audit.
44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 44 def freight_class @freight_class end |
#handling_unit ⇒ String
Type of handling unit. Common values: Pallet, Drum, Bag, Barrels, Crates, Bundles, Pieces, Loose, Boxes, Cases, Carton, Totes.
27 28 29 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 27 def handling_unit @handling_unit end |
#handling_unit_count ⇒ Integer
Number of handling units for this line item.
31 32 33 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 31 def handling_unit_count @handling_unit_count end |
#item_id ⇒ String
Caller-assigned identifier for this item. Referenced by ‘ChargeInput.itemId` to link a charge to a specific item.
18 19 20 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 18 def item_id @item_id end |
#weight ⇒ Float
Weight of this line item.
35 36 37 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 35 def weight @weight end |
#weight_unit ⇒ WeightUnit
Unit of measure for ‘weight`. Typically LBS or KG.
39 40 41 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 39 def weight_unit @weight_unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('itemId') ? hash['itemId'] : nil description = hash.key?('description') ? hash['description'] : SKIP handling_unit = hash.key?('handlingUnit') ? hash['handlingUnit'] : SKIP handling_unit_count = hash.key?('handlingUnitCount') ? hash['handlingUnitCount'] : SKIP weight = hash.key?('weight') ? hash['weight'] : SKIP weight_unit = hash['weightUnit'] ||= WeightUnit::LBS 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. InvoiceItemInput.new(item_id: item_id, description: description, handling_unit: handling_unit, handling_unit_count: handling_unit_count, weight: weight, weight_unit: weight_unit, freight_class: freight_class, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'itemId' @_hash['description'] = 'description' @_hash['handling_unit'] = 'handlingUnit' @_hash['handling_unit_count'] = 'handlingUnitCount' @_hash['weight'] = 'weight' @_hash['weight_unit'] = 'weightUnit' @_hash['freight_class'] = 'freightClass' @_hash end |
.nullables ⇒ Object
An array for nullable fields
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 72 def self.nullables %w[ description handling_unit handling_unit_count weight weight_unit freight_class ] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 60 def self.optionals %w[ description handling_unit handling_unit_count weight weight_unit freight_class ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 134 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.item_id, ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['itemId'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
156 157 158 159 160 161 162 163 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 156 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, description: #{@description.inspect},"\ " handling_unit: #{@handling_unit.inspect}, handling_unit_count:"\ " #{@handling_unit_count.inspect}, weight: #{@weight.inspect}, weight_unit:"\ " #{@weight_unit.inspect}, freight_class: #{@freight_class.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
147 148 149 150 151 152 153 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_item_input.rb', line 147 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, description: #{@description}, handling_unit:"\ " #{@handling_unit}, handling_unit_count: #{@handling_unit_count}, weight: #{@weight},"\ " weight_unit: #{@weight_unit}, freight_class: #{@freight_class}, additional_properties:"\ " #{@additional_properties}>" end |