Class: TqlOtrFactoringDataExchange::Invoice
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::Invoice
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/invoice.rb
Overview
An invoice object. Properties are organized into logical groups: invoice-level fields at the top, with nested ‘carrier`, `load`, `payment`, and `documents` objects.
Instance Attribute Summary collapse
-
#carrier ⇒ Carrier
Carrier details associated with this invoice.
-
#documents ⇒ Array[Document]
List of documents associated with this invoice.
-
#factoring_company_id ⇒ String
Identifier of the factoring company, if provided during submission.
-
#factoring_company_name ⇒ String
Name of the factoring company that submitted this invoice.
-
#has_claim ⇒ TrueClass | FalseClass
Whether a cargo claim has been filed against this invoice.
-
#invoice_number ⇒ String
The factoring company’s invoice number.
-
#last_updated_at ⇒ DateTime
UTC timestamp of the most recent update to this invoice.
-
#load ⇒ Load
TQL load details associated with this invoice.
-
#payment ⇒ Payment
Payment and billing details for this invoice.
-
#status ⇒ InvoiceStatus
Processing and payment status of an invoice.
-
#submitted_at ⇒ DateTime
UTC timestamp when the invoice was originally submitted.
-
#uri ⇒ String
Direct URI to retrieve the full invoice status via GET.
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(uri: SKIP, invoice_number: SKIP, factoring_company_name: SKIP, factoring_company_id: SKIP, status: SKIP, submitted_at: SKIP, last_updated_at: SKIP, has_claim: SKIP, carrier: SKIP, load: SKIP, payment: SKIP, documents: SKIP, additional_properties: nil) ⇒ Invoice
constructor
A new instance of Invoice.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_updated_at ⇒ Object
- #to_custom_submitted_at ⇒ Object
-
#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(uri: SKIP, invoice_number: SKIP, factoring_company_name: SKIP, factoring_company_id: SKIP, status: SKIP, submitted_at: SKIP, last_updated_at: SKIP, has_claim: SKIP, carrier: SKIP, load: SKIP, payment: SKIP, documents: SKIP, additional_properties: nil) ⇒ Invoice
Returns a new instance of Invoice.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 110 def initialize(uri: SKIP, invoice_number: SKIP, factoring_company_name: SKIP, factoring_company_id: SKIP, status: SKIP, submitted_at: SKIP, last_updated_at: SKIP, has_claim: SKIP, carrier: SKIP, load: SKIP, payment: SKIP, documents: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @uri = uri unless uri == SKIP @invoice_number = invoice_number unless invoice_number == SKIP @factoring_company_name = factoring_company_name unless factoring_company_name == SKIP @factoring_company_id = factoring_company_id unless factoring_company_id == SKIP @status = status unless status == SKIP @submitted_at = submitted_at unless submitted_at == SKIP @last_updated_at = last_updated_at unless last_updated_at == SKIP @has_claim = has_claim unless has_claim == SKIP @carrier = carrier unless carrier == SKIP @load = load unless load == SKIP @payment = payment unless payment == SKIP @documents = documents unless documents == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#carrier ⇒ Carrier
Carrier details associated with this invoice.
52 53 54 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 52 def carrier @carrier end |
#documents ⇒ Array[Document]
List of documents associated with this invoice. Each entry includes the document ID and its document type.
65 66 67 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 65 def documents @documents end |
#factoring_company_id ⇒ String
Identifier of the factoring company, if provided during submission.
29 30 31 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 29 def factoring_company_id @factoring_company_id end |
#factoring_company_name ⇒ String
Name of the factoring company that submitted this invoice.
25 26 27 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 25 def factoring_company_name @factoring_company_name end |
#has_claim ⇒ TrueClass | FalseClass
Whether a cargo claim has been filed against this invoice.
48 49 50 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 48 def has_claim @has_claim end |
#invoice_number ⇒ String
The factoring company’s invoice number.
21 22 23 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 21 def invoice_number @invoice_number end |
#last_updated_at ⇒ DateTime
UTC timestamp of the most recent update to this invoice.
44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 44 def last_updated_at @last_updated_at end |
#load ⇒ Load
TQL load details associated with this invoice.
56 57 58 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 56 def load @load end |
#payment ⇒ Payment
Payment and billing details for this invoice.
60 61 62 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 60 def payment @payment end |
#status ⇒ InvoiceStatus
Processing and payment status of an invoice. The lifecycle typically flows: ‘Received` → `Validating` → `Processing` → `Approved` → `NotPaid` →`Paid`. Branches include `AwaitingDocuments`, `PendingExceptions`, and `Rejected`.
36 37 38 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 36 def status @status end |
#submitted_at ⇒ DateTime
UTC timestamp when the invoice was originally submitted.
40 41 42 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 40 def submitted_at @submitted_at end |
#uri ⇒ String
Direct URI to retrieve the full invoice status via GET.
17 18 19 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 17 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
134 135 136 137 138 139 140 141 142 143 144 145 146 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 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 134 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uri = hash.key?('uri') ? hash['uri'] : SKIP invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP factoring_company_name = hash.key?('factoringCompanyName') ? hash['factoringCompanyName'] : SKIP factoring_company_id = hash.key?('factoringCompanyId') ? hash['factoringCompanyId'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP submitted_at = if hash.key?('submittedAt') (DateTimeHelper.from_rfc3339(hash['submittedAt']) if hash['submittedAt']) else SKIP end last_updated_at = if hash.key?('lastUpdatedAt') (DateTimeHelper.from_rfc3339(hash['lastUpdatedAt']) if hash['lastUpdatedAt']) else SKIP end has_claim = hash.key?('hasClaim') ? hash['hasClaim'] : SKIP carrier = Carrier.from_hash(hash['carrier']) if hash['carrier'] load = Load.from_hash(hash['load']) if hash['load'] payment = Payment.from_hash(hash['payment']) if hash['payment'] # Parameter is an array, so we need to iterate through it documents = nil unless hash['documents'].nil? documents = [] hash['documents'].each do |structure| documents << (Document.from_hash(structure) if structure) end end documents = SKIP unless hash.key?('documents') # 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. Invoice.new(uri: uri, invoice_number: invoice_number, factoring_company_name: factoring_company_name, factoring_company_id: factoring_company_id, status: status, submitted_at: submitted_at, last_updated_at: last_updated_at, has_claim: has_claim, carrier: carrier, load: load, payment: payment, documents: documents, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 68 def self.names @_hash = {} if @_hash.nil? @_hash['uri'] = 'uri' @_hash['invoice_number'] = 'invoiceNumber' @_hash['factoring_company_name'] = 'factoringCompanyName' @_hash['factoring_company_id'] = 'factoringCompanyId' @_hash['status'] = 'status' @_hash['submitted_at'] = 'submittedAt' @_hash['last_updated_at'] = 'lastUpdatedAt' @_hash['has_claim'] = 'hasClaim' @_hash['carrier'] = 'carrier' @_hash['load'] = 'load' @_hash['payment'] = 'payment' @_hash['documents'] = 'documents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
104 105 106 107 108 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 104 def self.nullables %w[ factoring_company_id ] end |
.optionals ⇒ Object
An array for optional fields
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 86 def self.optionals %w[ uri invoice_number factoring_company_name factoring_company_id status submitted_at last_updated_at has_claim carrier load payment documents ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 212 def inspect class_name = self.class.name.split('::').last "<#{class_name} uri: #{@uri.inspect}, invoice_number: #{@invoice_number.inspect},"\ " factoring_company_name: #{@factoring_company_name.inspect}, factoring_company_id:"\ " #{@factoring_company_id.inspect}, status: #{@status.inspect}, submitted_at:"\ " #{@submitted_at.inspect}, last_updated_at: #{@last_updated_at.inspect}, has_claim:"\ " #{@has_claim.inspect}, carrier: #{@carrier.inspect}, load: #{@load.inspect}, payment:"\ " #{@payment.inspect}, documents: #{@documents.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_last_updated_at ⇒ Object
197 198 199 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 197 def to_custom_last_updated_at DateTimeHelper.to_rfc3339(last_updated_at) end |
#to_custom_submitted_at ⇒ Object
193 194 195 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 193 def to_custom_submitted_at DateTimeHelper.to_rfc3339(submitted_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
202 203 204 205 206 207 208 209 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice.rb', line 202 def to_s class_name = self.class.name.split('::').last "<#{class_name} uri: #{@uri}, invoice_number: #{@invoice_number}, factoring_company_name:"\ " #{@factoring_company_name}, factoring_company_id: #{@factoring_company_id}, status:"\ " #{@status}, submitted_at: #{@submitted_at}, last_updated_at: #{@last_updated_at},"\ " has_claim: #{@has_claim}, carrier: #{@carrier}, load: #{@load}, payment: #{@payment},"\ " documents: #{@documents}, additional_properties: #{@additional_properties}>" end |