Class: FreightFinancialsWebhookIngestionApi::Invoice
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FreightFinancialsWebhookIngestionApi::Invoice
- Defined in:
- lib/freight_financials_webhook_ingestion_api/models/invoice.rb
Overview
Invoice Model.
Instance Attribute Summary collapse
-
#carrier ⇒ Carrier
TODO: Write general description for this method.
-
#documents ⇒ Array[InvoiceDocument]
TODO: Write general description for this method.
-
#factoring_company_id ⇒ String
TODO: Write general description for this method.
-
#factoring_company_name ⇒ String
TODO: Write general description for this method.
-
#has_claim ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#invoice_number ⇒ String
TODO: Write general description for this method.
-
#last_updated_at ⇒ DateTime
TODO: Write general description for this method.
-
#load ⇒ LoadSlim
TODO: Write general description for this method.
-
#payment ⇒ Payment
TODO: Write general description for this method.
-
#status ⇒ Integer
TODO: Write general description for this method.
-
#submitted_at ⇒ DateTime
TODO: Write general description for this method.
-
#uri ⇒ String
TODO: Write general description for this method.
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(carrier: SKIP, documents: SKIP, factoring_company_id: SKIP, factoring_company_name: SKIP, has_claim: SKIP, invoice_number: SKIP, last_updated_at: SKIP, load: SKIP, payment: SKIP, status: SKIP, submitted_at: SKIP, uri: SKIP) ⇒ 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(carrier: SKIP, documents: SKIP, factoring_company_id: SKIP, factoring_company_name: SKIP, has_claim: SKIP, invoice_number: SKIP, last_updated_at: SKIP, load: SKIP, payment: SKIP, status: SKIP, submitted_at: SKIP, uri: SKIP) ⇒ Invoice
Returns a new instance of Invoice.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 105 def initialize(carrier: SKIP, documents: SKIP, factoring_company_id: SKIP, factoring_company_name: SKIP, has_claim: SKIP, invoice_number: SKIP, last_updated_at: SKIP, load: SKIP, payment: SKIP, status: SKIP, submitted_at: SKIP, uri: SKIP) @carrier = carrier unless carrier == SKIP @documents = documents unless documents == SKIP @factoring_company_id = factoring_company_id unless factoring_company_id == SKIP @factoring_company_name = factoring_company_name unless factoring_company_name == SKIP @has_claim = has_claim unless has_claim == SKIP @invoice_number = invoice_number unless invoice_number == SKIP @last_updated_at = last_updated_at unless last_updated_at == SKIP @load = load unless load == SKIP @payment = payment unless payment == SKIP @status = status unless status == SKIP @submitted_at = submitted_at unless submitted_at == SKIP @uri = uri unless uri == SKIP end |
Instance Attribute Details
#carrier ⇒ Carrier
TODO: Write general description for this method
15 16 17 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 15 def carrier @carrier end |
#documents ⇒ Array[InvoiceDocument]
TODO: Write general description for this method
19 20 21 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 19 def documents @documents end |
#factoring_company_id ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 23 def factoring_company_id @factoring_company_id end |
#factoring_company_name ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 27 def factoring_company_name @factoring_company_name end |
#has_claim ⇒ TrueClass | FalseClass
TODO: Write general description for this method
31 32 33 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 31 def has_claim @has_claim end |
#invoice_number ⇒ String
TODO: Write general description for this method
35 36 37 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 35 def invoice_number @invoice_number end |
#last_updated_at ⇒ DateTime
TODO: Write general description for this method
39 40 41 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 39 def last_updated_at @last_updated_at end |
#load ⇒ LoadSlim
TODO: Write general description for this method
43 44 45 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 43 def load @load end |
#payment ⇒ Payment
TODO: Write general description for this method
47 48 49 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 47 def payment @payment end |
#status ⇒ Integer
TODO: Write general description for this method
51 52 53 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 51 def status @status end |
#submitted_at ⇒ DateTime
TODO: Write general description for this method
55 56 57 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 55 def submitted_at @submitted_at end |
#uri ⇒ String
TODO: Write general description for this method
59 60 61 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 59 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
124 125 126 127 128 129 130 131 132 133 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 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 124 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier = Carrier.from_hash(hash['carrier']) if hash['carrier'] # Parameter is an array, so we need to iterate through it documents = nil unless hash['documents'].nil? documents = [] hash['documents'].each do |structure| documents << (InvoiceDocument.from_hash(structure) if structure) end end documents = SKIP unless hash.key?('documents') factoring_company_id = hash.key?('factoringCompanyId') ? hash['factoringCompanyId'] : SKIP factoring_company_name = hash.key?('factoringCompanyName') ? hash['factoringCompanyName'] : SKIP has_claim = hash.key?('hasClaim') ? hash['hasClaim'] : SKIP invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP last_updated_at = if hash.key?('lastUpdatedAt') (DateTimeHelper.from_rfc3339(hash['lastUpdatedAt']) if hash['lastUpdatedAt']) else SKIP end load = LoadSlim.from_hash(hash['load']) if hash['load'] payment = Payment.from_hash(hash['payment']) if hash['payment'] status = hash.key?('status') ? hash['status'] : SKIP submitted_at = if hash.key?('submittedAt') (DateTimeHelper.from_rfc3339(hash['submittedAt']) if hash['submittedAt']) else SKIP end uri = hash.key?('uri') ? hash['uri'] : SKIP # Create object from extracted values. Invoice.new(carrier: carrier, documents: documents, factoring_company_id: factoring_company_id, factoring_company_name: factoring_company_name, has_claim: has_claim, invoice_number: invoice_number, last_updated_at: last_updated_at, load: load, payment: payment, status: status, submitted_at: submitted_at, uri: uri) end |
.names ⇒ Object
A mapping from model property names to API property names.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 62 def self.names @_hash = {} if @_hash.nil? @_hash['carrier'] = 'carrier' @_hash['documents'] = 'documents' @_hash['factoring_company_id'] = 'factoringCompanyId' @_hash['factoring_company_name'] = 'factoringCompanyName' @_hash['has_claim'] = 'hasClaim' @_hash['invoice_number'] = 'invoiceNumber' @_hash['last_updated_at'] = 'lastUpdatedAt' @_hash['load'] = 'load' @_hash['payment'] = 'payment' @_hash['status'] = 'status' @_hash['submitted_at'] = 'submittedAt' @_hash['uri'] = 'uri' @_hash end |
.nullables ⇒ Object
An array for nullable fields
98 99 100 101 102 103 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 98 def self.nullables %w[ factoring_company_id uri ] end |
.optionals ⇒ Object
An array for optional fields
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 80 def self.optionals %w[ carrier documents factoring_company_id factoring_company_name has_claim invoice_number last_updated_at load payment status submitted_at uri ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
194 195 196 197 198 199 200 201 202 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 194 def inspect class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier.inspect}, documents: #{@documents.inspect},"\ " factoring_company_id: #{@factoring_company_id.inspect}, factoring_company_name:"\ " #{@factoring_company_name.inspect}, has_claim: #{@has_claim.inspect}, invoice_number:"\ " #{@invoice_number.inspect}, last_updated_at: #{@last_updated_at.inspect}, load:"\ " #{@load.inspect}, payment: #{@payment.inspect}, status: #{@status.inspect}, submitted_at:"\ " #{@submitted_at.inspect}, uri: #{@uri.inspect}>" end |
#to_custom_last_updated_at ⇒ Object
175 176 177 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 175 def to_custom_last_updated_at DateTimeHelper.to_rfc3339(last_updated_at) end |
#to_custom_submitted_at ⇒ Object
179 180 181 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 179 def to_custom_submitted_at DateTimeHelper.to_rfc3339(submitted_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
184 185 186 187 188 189 190 191 |
# File 'lib/freight_financials_webhook_ingestion_api/models/invoice.rb', line 184 def to_s class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier}, documents: #{@documents}, factoring_company_id:"\ " #{@factoring_company_id}, factoring_company_name: #{@factoring_company_name}, has_claim:"\ " #{@has_claim}, invoice_number: #{@invoice_number}, last_updated_at: #{@last_updated_at},"\ " load: #{@load}, payment: #{@payment}, status: #{@status}, submitted_at: #{@submitted_at},"\ " uri: #{@uri}>" end |