Class: TqlOtrFactoringDataExchange::SubmitInvoiceRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::SubmitInvoiceRequest
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb
Overview
Factoring company invoice submitted against a TQL load. Documents should be uploaded separately via ‘POST /api/documents`.
Instance Attribute Summary collapse
-
#carrier ⇒ Object
Carrier information for the invoiced shipment.
-
#carrier_invoice_number ⇒ String
The carrier’s own invoice number, if different from the factoring company’s invoice number.
-
#charges ⇒ Array[ChargeInput]
One or more carrier charge line items on this invoice.
-
#factoring_company ⇒ FactoringCompanyInput
Identifies the factoring company that purchased (bought out) the carrier’s loads.
-
#invoice_date ⇒ Date
Date the invoice was generated or sent by the factoring company.
-
#invoice_due_date ⇒ Date
Date by which the invoice should be paid, if known.
-
#invoice_number ⇒ String
The factoring company’s invoice number for this shipment.
-
#items ⇒ Array[InvoiceItemInput]
Physical line items describing the freight being shipped.
-
#load_number ⇒ String
The TQL load number this invoice is billed against.
-
#payment_terms ⇒ String
Invoice payment terms.
-
#reference_numbers ⇒ Array[ReferenceNumberInput]
One or more reference numbers (PRO, PO, BOL, etc.) to cross-reference this invoice with the TQL load.
-
#stops ⇒ Array[StopInput]
Ordered list of stops for the invoiced shipment.
-
#type ⇒ InvoiceType
Indicates the purpose of the invoice being submitted.
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(load_number:, invoice_number:, carrier:, factoring_company:, stops:, charges:, reference_numbers:, invoice_date:, type: InvoiceType::INVOICE, carrier_invoice_number: SKIP, items: SKIP, invoice_due_date: SKIP, payment_terms: SKIP, additional_properties: nil) ⇒ SubmitInvoiceRequest
constructor
A new instance of SubmitInvoiceRequest.
-
#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(load_number:, invoice_number:, carrier:, factoring_company:, stops:, charges:, reference_numbers:, invoice_date:, type: InvoiceType::INVOICE, carrier_invoice_number: SKIP, items: SKIP, invoice_due_date: SKIP, payment_terms: SKIP, additional_properties: nil) ⇒ SubmitInvoiceRequest
Returns a new instance of SubmitInvoiceRequest.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 135 def initialize(load_number:, invoice_number:, carrier:, factoring_company:, stops:, charges:, reference_numbers:, invoice_date:, type: InvoiceType::INVOICE, carrier_invoice_number: SKIP, items: SKIP, invoice_due_date: SKIP, payment_terms: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = type unless type == SKIP @load_number = load_number @invoice_number = invoice_number @carrier_invoice_number = carrier_invoice_number unless carrier_invoice_number == SKIP @carrier = carrier @factoring_company = factoring_company @stops = stops @charges = charges @items = items unless items == SKIP @reference_numbers = reference_numbers @invoice_date = invoice_date @invoice_due_date = invoice_due_date unless invoice_due_date == SKIP @payment_terms = payment_terms unless payment_terms == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#carrier ⇒ Object
Carrier information for the invoiced shipment. At least one of ‘mcNumber` or `dotNumber` must be provided.
49 50 51 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 49 def carrier @carrier end |
#carrier_invoice_number ⇒ String
The carrier’s own invoice number, if different from the factoring company’s invoice number. Optional.
44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 44 def carrier_invoice_number @carrier_invoice_number end |
#charges ⇒ Array[ChargeInput]
One or more carrier charge line items on this invoice.
63 64 65 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 63 def charges @charges end |
#factoring_company ⇒ FactoringCompanyInput
Identifies the factoring company that purchased (bought out) the carrier’s loads.
54 55 56 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 54 def factoring_company @factoring_company end |
#invoice_date ⇒ Date
Date the invoice was generated or sent by the factoring company. [ISO 8601](www.iso.org/iso-8601-date-and-time-format.html) date format (YYYY-MM-DD).
82 83 84 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 82 def invoice_date @invoice_date end |
#invoice_due_date ⇒ Date
Date by which the invoice should be paid, if known. [ISO 8601](www.iso.org/iso-8601-date-and-time-format.html) date format (YYYY-MM-DD).
88 89 90 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 88 def invoice_due_date @invoice_due_date end |
#invoice_number ⇒ String
The factoring company’s invoice number for this shipment. This is the primary identifier the factoring company uses to track this invoice.
39 40 41 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 39 def invoice_number @invoice_number end |
#items ⇒ Array[InvoiceItemInput]
Physical line items describing the freight being shipped. Each item represents a distinct commodity or handling unit on the load — for example, 4 pallets of paper towels at 2,310 lbs, freight class 100. Items describe **what was moved**; charges describe **what you are billing**. These are independent concepts — charges are not linked to specific items.
71 72 73 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 71 def items @items end |
#load_number ⇒ String
The TQL load number this invoice is billed against. This is the load identifier assigned by TQL and must match an existing load in the TQL system.
34 35 36 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 34 def load_number @load_number end |
#payment_terms ⇒ String
Invoice payment terms. Use ‘NetN` where N is the number of days until payment is due (0–365), or `Prepaid` for invoices paid in advance.
93 94 95 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 93 def payment_terms @payment_terms end |
#reference_numbers ⇒ Array[ReferenceNumberInput]
One or more reference numbers (PRO, PO, BOL, etc.) to cross-reference this invoice with the TQL load.
76 77 78 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 76 def reference_numbers @reference_numbers end |
#stops ⇒ Array[StopInput]
Ordered list of stops for the invoiced shipment. Must include at least an origin and a destination.
59 60 61 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 59 def stops @stops end |
#type ⇒ InvoiceType
Indicates the purpose of the invoice being submitted.
-
Invoice — A standard carrier invoice for freight services rendered on a load. This is the initial, primary billing submitted by the factoring company on behalf of the carrier.
-
BalanceDue — A follow-up invoice for the remaining balance after a partial payment or short-pay on a previously submitted invoice. Use this type when the original invoice was paid at less than the full amount and the carrier is billing for the difference.
-
Supplemental — An additional invoice for charges that were not included on the original invoice. Common examples include detention charges, lumper fees, or other accessorials discovered or finalized after the initial invoice was submitted.
28 29 30 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 28 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 160 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. load_number = hash.key?('loadNumber') ? hash['loadNumber'] : nil invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : nil carrier = hash.key?('carrier') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CarrierInput2), hash['carrier'] ) : nil factoring_company = FactoringCompanyInput.from_hash(hash['factoringCompany']) if hash['factoringCompany'] # Parameter is an array, so we need to iterate through it stops = nil unless hash['stops'].nil? stops = [] hash['stops'].each do |structure| stops << (StopInput.from_hash(structure) if structure) end end stops = nil unless hash.key?('stops') # Parameter is an array, so we need to iterate through it charges = nil unless hash['charges'].nil? charges = [] hash['charges'].each do |structure| charges << (ChargeInput.from_hash(structure) if structure) end end charges = nil unless hash.key?('charges') # Parameter is an array, so we need to iterate through it reference_numbers = nil unless hash['referenceNumbers'].nil? reference_numbers = [] hash['referenceNumbers'].each do |structure| reference_numbers << (ReferenceNumberInput.from_hash(structure) if structure) end end reference_numbers = nil unless hash.key?('referenceNumbers') invoice_date = hash.key?('invoiceDate') ? hash['invoiceDate'] : nil type = hash['type'] ||= InvoiceType::INVOICE carrier_invoice_number = hash.key?('carrierInvoiceNumber') ? hash['carrierInvoiceNumber'] : SKIP # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (InvoiceItemInput.from_hash(structure) if structure) end end items = SKIP unless hash.key?('items') invoice_due_date = hash.key?('invoiceDueDate') ? hash['invoiceDueDate'] : SKIP payment_terms = hash.key?('paymentTerms') ? hash['paymentTerms'] : 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. SubmitInvoiceRequest.new(load_number: load_number, invoice_number: invoice_number, carrier: carrier, factoring_company: factoring_company, stops: stops, charges: charges, reference_numbers: reference_numbers, invoice_date: invoice_date, type: type, carrier_invoice_number: carrier_invoice_number, items: items, invoice_due_date: invoice_due_date, payment_terms: payment_terms, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 96 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['load_number'] = 'loadNumber' @_hash['invoice_number'] = 'invoiceNumber' @_hash['carrier_invoice_number'] = 'carrierInvoiceNumber' @_hash['carrier'] = 'carrier' @_hash['factoring_company'] = 'factoringCompany' @_hash['stops'] = 'stops' @_hash['charges'] = 'charges' @_hash['items'] = 'items' @_hash['reference_numbers'] = 'referenceNumbers' @_hash['invoice_date'] = 'invoiceDate' @_hash['invoice_due_date'] = 'invoiceDueDate' @_hash['payment_terms'] = 'paymentTerms' @_hash end |
.nullables ⇒ Object
An array for nullable fields
126 127 128 129 130 131 132 133 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 126 def self.nullables %w[ carrier_invoice_number items invoice_due_date payment_terms ] end |
.optionals ⇒ Object
An array for optional fields
115 116 117 118 119 120 121 122 123 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 115 def self.optionals %w[ type carrier_invoice_number items invoice_due_date payment_terms ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 245 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.load_number, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.invoice_number, ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:CarrierInput2) .validate(value.carrier) and APIHelper.valid_type?(value.factoring_company, ->(val) { FactoringCompanyInput.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.stops, ->(val) { StopInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.charges, ->(val) { ChargeInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.reference_numbers, ->(val) { ReferenceNumberInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.invoice_date, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['loadNumber'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['invoiceNumber'], ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:CarrierInput2) .validate(value['carrier']) and APIHelper.valid_type?(value['factoringCompany'], ->(val) { FactoringCompanyInput.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['stops'], ->(val) { StopInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['charges'], ->(val) { ChargeInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['referenceNumbers'], ->(val) { ReferenceNumberInput.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['invoiceDate'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
315 316 317 318 319 320 321 322 323 324 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 315 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, load_number: #{@load_number.inspect},"\ " invoice_number: #{@invoice_number.inspect}, carrier_invoice_number:"\ " #{@carrier_invoice_number.inspect}, carrier: #{@carrier.inspect}, factoring_company:"\ " #{@factoring_company.inspect}, stops: #{@stops.inspect}, charges: #{@charges.inspect},"\ " items: #{@items.inspect}, reference_numbers: #{@reference_numbers.inspect}, invoice_date:"\ " #{@invoice_date.inspect}, invoice_due_date: #{@invoice_due_date.inspect}, payment_terms:"\ " #{@payment_terms.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
304 305 306 307 308 309 310 311 312 |
# File 'lib/tql_otr_factoring_data_exchange/models/submit_invoice_request.rb', line 304 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, load_number: #{@load_number}, invoice_number:"\ " #{@invoice_number}, carrier_invoice_number: #{@carrier_invoice_number}, carrier:"\ " #{@carrier}, factoring_company: #{@factoring_company}, stops: #{@stops}, charges:"\ " #{@charges}, items: #{@items}, reference_numbers: #{@reference_numbers}, invoice_date:"\ " #{@invoice_date}, invoice_due_date: #{@invoice_due_date}, payment_terms:"\ " #{@payment_terms}, additional_properties: #{@additional_properties}>" end |