Class: Mindee::V1::Product::FinancialDocument::FinancialDocumentV1Document
- Inherits:
-
Mindee::V1::Parsing::Common::Prediction
- Object
- Mindee::V1::Parsing::Common::Prediction
- Mindee::V1::Product::FinancialDocument::FinancialDocumentV1Document
- Includes:
- Mindee::V1::Parsing::Standard
- Defined in:
- lib/mindee/v1/product/financial_document/financial_document_v1_document.rb
Overview
Financial Document API version 1.14 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#billing_address ⇒ Mindee::V1::Parsing::Standard::AddressField
readonly
The customer's address used for billing.
-
#category ⇒ Mindee::V1::Parsing::Standard::ClassificationField
readonly
The purchase category.
-
#customer_address ⇒ Mindee::V1::Parsing::Standard::AddressField
readonly
The address of the customer.
-
#customer_company_registrations ⇒ Array<Mindee::V1::Parsing::Standard::CompanyRegistrationField>
readonly
List of company registration numbers associated to the customer.
-
#customer_id ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The customer account number or identifier from the supplier.
-
#customer_name ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The name of the customer.
-
#date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date the purchase was made.
-
#document_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The document number or identifier (invoice number or receipt number).
-
#document_type ⇒ Mindee::V1::Parsing::Standard::ClassificationField
readonly
The type of the document: INVOICE or CREDIT NOTE if it is an invoice, CREDIT CARD RECEIPT or EXPENSE RECEIPT if it is a receipt.
-
#document_type_extended ⇒ Mindee::V1::Parsing::Standard::ClassificationField
readonly
Document type extended.
-
#due_date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date on which the payment is due.
-
#invoice_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The invoice number or identifier only if document is an invoice.
-
#line_items ⇒ Mindee::V1::Product::FinancialDocument::FinancialDocumentV1LineItems
readonly
List of line item present on the document.
-
#locale ⇒ Mindee::V1::Parsing::Standard::LocaleField
readonly
The locale of the document.
-
#payment_date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date on which the payment is due / fullfilled.
-
#po_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The purchase order number, only if the document is an invoice.
-
#receipt_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The receipt number or identifier only if document is a receipt.
-
#reference_numbers ⇒ Array<Mindee::V1::Parsing::Standard::StringField>
readonly
List of Reference numbers, including PO number, only if the document is an invoice.
-
#shipping_address ⇒ Mindee::V1::Parsing::Standard::AddressField
readonly
The customer's address used for shipping.
-
#subcategory ⇒ Mindee::V1::Parsing::Standard::ClassificationField
readonly
The purchase subcategory for transport, food and shooping.
-
#supplier_address ⇒ Mindee::V1::Parsing::Standard::AddressField
readonly
The address of the supplier or merchant.
-
#supplier_company_registrations ⇒ Array<Mindee::V1::Parsing::Standard::CompanyRegistrationField>
readonly
List of company registration numbers associated to the supplier.
-
#supplier_email ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The email of the supplier or merchant.
-
#supplier_name ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The name of the supplier or merchant.
-
#supplier_payment_details ⇒ Array<Mindee::V1::Parsing::Standard::PaymentDetailsField>
readonly
List of payment details associated to the supplier (only for invoices).
-
#supplier_phone_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The phone number of the supplier or merchant.
-
#supplier_website ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The website URL of the supplier or merchant.
-
#taxes ⇒ Mindee::V1::Parsing::Standard::Taxes
readonly
List of all taxes on the document.
-
#time ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The time the purchase was made (only for receipts).
-
#tip ⇒ Mindee::V1::Parsing::Standard::AmountField
readonly
The total amount of tip and gratuity.
-
#total_amount ⇒ Mindee::V1::Parsing::Standard::AmountField
readonly
The total amount paid: includes taxes, tips, fees, and other charges.
-
#total_net ⇒ Mindee::V1::Parsing::Standard::AmountField
readonly
The net amount paid: does not include taxes, fees, and discounts.
-
#total_tax ⇒ Mindee::V1::Parsing::Standard::AmountField
readonly
The sum of all taxes present on the document.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ FinancialDocumentV1Document
constructor
A new instance of FinancialDocumentV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ FinancialDocumentV1Document
Returns a new instance of FinancialDocumentV1Document.
117 118 119 120 121 122 123 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 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 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 117 def initialize(prediction, page_id) super @billing_address = Parsing::Standard::AddressField.new( prediction['billing_address'], page_id ) @category = Parsing::Standard::ClassificationField.new( prediction['category'], page_id ) @customer_address = Parsing::Standard::AddressField.new( prediction['customer_address'], page_id ) @customer_company_registrations = [] # : Array[Parsing::Standard::CompanyRegistrationField] prediction['customer_company_registrations'].each do |item| @customer_company_registrations.push(Parsing::Standard::CompanyRegistrationField.new(item, page_id)) end @customer_id = Parsing::Standard::StringField.new( prediction['customer_id'], page_id ) @customer_name = Parsing::Standard::StringField.new( prediction['customer_name'], page_id ) @date = Parsing::Standard::DateField.new(prediction['date'], page_id) @document_number = Parsing::Standard::StringField.new( prediction['document_number'], page_id ) @document_type = Parsing::Standard::ClassificationField.new( prediction['document_type'], page_id ) @document_type_extended = Parsing::Standard::ClassificationField.new( prediction['document_type_extended'], page_id ) @due_date = Parsing::Standard::DateField.new( prediction['due_date'], page_id ) @invoice_number = Parsing::Standard::StringField.new( prediction['invoice_number'], page_id ) @line_items = Product::FinancialDocument::FinancialDocumentV1LineItems.new( prediction['line_items'], page_id ) @locale = Parsing::Standard::LocaleField.new( prediction['locale'], page_id ) @payment_date = Parsing::Standard::DateField.new( prediction['payment_date'], page_id ) @po_number = Parsing::Standard::StringField.new( prediction['po_number'], page_id ) @receipt_number = Parsing::Standard::StringField.new( prediction['receipt_number'], page_id ) @reference_numbers = [] # : Array[Parsing::Standard::StringField] prediction['reference_numbers'].each do |item| @reference_numbers.push(Parsing::Standard::StringField.new(item, page_id)) end @shipping_address = Parsing::Standard::AddressField.new( prediction['shipping_address'], page_id ) @subcategory = Parsing::Standard::ClassificationField.new( prediction['subcategory'], page_id ) @supplier_address = Parsing::Standard::AddressField.new( prediction['supplier_address'], page_id ) @supplier_company_registrations = [] # : Array[Parsing::Standard::CompanyRegistrationField] prediction['supplier_company_registrations'].each do |item| @supplier_company_registrations.push(Parsing::Standard::CompanyRegistrationField.new(item, page_id)) end @supplier_email = Parsing::Standard::StringField.new( prediction['supplier_email'], page_id ) @supplier_name = Parsing::Standard::StringField.new( prediction['supplier_name'], page_id ) @supplier_payment_details = [] # : Array[Parsing::Standard::PaymentDetailsField] prediction['supplier_payment_details'].each do |item| @supplier_payment_details.push(Parsing::Standard::PaymentDetailsField.new(item, page_id)) end @supplier_phone_number = Parsing::Standard::StringField.new( prediction['supplier_phone_number'], page_id ) @supplier_website = Parsing::Standard::StringField.new( prediction['supplier_website'], page_id ) @taxes = Parsing::Standard::Taxes.new(prediction['taxes'], page_id) @time = Parsing::Standard::StringField.new(prediction['time'], page_id) @tip = Parsing::Standard::AmountField.new(prediction['tip'], page_id) @total_amount = Parsing::Standard::AmountField.new( prediction['total_amount'], page_id ) @total_net = Parsing::Standard::AmountField.new( prediction['total_net'], page_id ) @total_tax = Parsing::Standard::AmountField.new( prediction['total_tax'], page_id ) end |
Instance Attribute Details
#billing_address ⇒ Mindee::V1::Parsing::Standard::AddressField (readonly)
The customer's address used for billing.
16 17 18 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 16 def billing_address @billing_address end |
#category ⇒ Mindee::V1::Parsing::Standard::ClassificationField (readonly)
The purchase category.
19 20 21 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 19 def category @category end |
#customer_address ⇒ Mindee::V1::Parsing::Standard::AddressField (readonly)
The address of the customer.
22 23 24 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 22 def customer_address @customer_address end |
#customer_company_registrations ⇒ Array<Mindee::V1::Parsing::Standard::CompanyRegistrationField> (readonly)
List of company registration numbers associated to the customer.
25 26 27 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 25 def customer_company_registrations @customer_company_registrations end |
#customer_id ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The customer account number or identifier from the supplier.
28 29 30 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 28 def customer_id @customer_id end |
#customer_name ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The name of the customer.
31 32 33 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 31 def customer_name @customer_name end |
#date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date the purchase was made.
34 35 36 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 34 def date @date end |
#document_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The document number or identifier (invoice number or receipt number).
37 38 39 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 37 def document_number @document_number end |
#document_type ⇒ Mindee::V1::Parsing::Standard::ClassificationField (readonly)
The type of the document: INVOICE or CREDIT NOTE if it is an invoice, CREDIT CARD RECEIPT or EXPENSE RECEIPT if it is a receipt.
41 42 43 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 41 def document_type @document_type end |
#document_type_extended ⇒ Mindee::V1::Parsing::Standard::ClassificationField (readonly)
Document type extended.
44 45 46 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 44 def document_type_extended @document_type_extended end |
#due_date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date on which the payment is due.
47 48 49 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 47 def due_date @due_date end |
#invoice_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The invoice number or identifier only if document is an invoice.
50 51 52 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 50 def invoice_number @invoice_number end |
#line_items ⇒ Mindee::V1::Product::FinancialDocument::FinancialDocumentV1LineItems (readonly)
List of line item present on the document.
53 54 55 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 53 def line_items @line_items end |
#locale ⇒ Mindee::V1::Parsing::Standard::LocaleField (readonly)
The locale of the document.
56 57 58 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 56 def locale @locale end |
#payment_date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date on which the payment is due / fullfilled.
59 60 61 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 59 def payment_date @payment_date end |
#po_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The purchase order number, only if the document is an invoice.
62 63 64 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 62 def po_number @po_number end |
#receipt_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The receipt number or identifier only if document is a receipt.
65 66 67 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 65 def receipt_number @receipt_number end |
#reference_numbers ⇒ Array<Mindee::V1::Parsing::Standard::StringField> (readonly)
List of Reference numbers, including PO number, only if the document is an invoice.
68 69 70 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 68 def reference_numbers @reference_numbers end |
#shipping_address ⇒ Mindee::V1::Parsing::Standard::AddressField (readonly)
The customer's address used for shipping.
71 72 73 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 71 def shipping_address @shipping_address end |
#subcategory ⇒ Mindee::V1::Parsing::Standard::ClassificationField (readonly)
The purchase subcategory for transport, food and shooping.
74 75 76 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 74 def subcategory @subcategory end |
#supplier_address ⇒ Mindee::V1::Parsing::Standard::AddressField (readonly)
The address of the supplier or merchant.
77 78 79 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 77 def supplier_address @supplier_address end |
#supplier_company_registrations ⇒ Array<Mindee::V1::Parsing::Standard::CompanyRegistrationField> (readonly)
List of company registration numbers associated to the supplier.
80 81 82 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 80 def supplier_company_registrations @supplier_company_registrations end |
#supplier_email ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The email of the supplier or merchant.
83 84 85 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 83 def supplier_email @supplier_email end |
#supplier_name ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The name of the supplier or merchant.
86 87 88 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 86 def supplier_name @supplier_name end |
#supplier_payment_details ⇒ Array<Mindee::V1::Parsing::Standard::PaymentDetailsField> (readonly)
List of payment details associated to the supplier (only for invoices).
89 90 91 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 89 def supplier_payment_details @supplier_payment_details end |
#supplier_phone_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The phone number of the supplier or merchant.
92 93 94 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 92 def supplier_phone_number @supplier_phone_number end |
#supplier_website ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The website URL of the supplier or merchant.
95 96 97 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 95 def supplier_website @supplier_website end |
#taxes ⇒ Mindee::V1::Parsing::Standard::Taxes (readonly)
List of all taxes on the document.
98 99 100 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 98 def taxes @taxes end |
#time ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The time the purchase was made (only for receipts).
101 102 103 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 101 def time @time end |
#tip ⇒ Mindee::V1::Parsing::Standard::AmountField (readonly)
The total amount of tip and gratuity
104 105 106 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 104 def tip @tip end |
#total_amount ⇒ Mindee::V1::Parsing::Standard::AmountField (readonly)
The total amount paid: includes taxes, tips, fees, and other charges.
107 108 109 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 107 def total_amount @total_amount end |
#total_net ⇒ Mindee::V1::Parsing::Standard::AmountField (readonly)
The net amount paid: does not include taxes, fees, and discounts.
110 111 112 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 110 def total_net @total_net end |
#total_tax ⇒ Mindee::V1::Parsing::Standard::AmountField (readonly)
The sum of all taxes present on the document.
113 114 115 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 113 def total_tax @total_tax end |
Instance Method Details
#to_s ⇒ String
241 242 243 244 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 |
# File 'lib/mindee/v1/product/financial_document/financial_document_v1_document.rb', line 241 def to_s reference_numbers = @reference_numbers.join("\n #{' ' * 19}") supplier_payment_details = @supplier_payment_details.join("\n #{' ' * 26}") supplier_company_registrations = @supplier_company_registrations.join("\n #{' ' * 32}") customer_company_registrations = @customer_company_registrations.join("\n #{' ' * 32}") line_items = line_items_to_s out_str = String.new out_str << "\n:Locale: #{@locale}".rstrip out_str << "\n:Invoice Number: #{@invoice_number}".rstrip out_str << "\n:Purchase Order Number: #{@po_number}".rstrip out_str << "\n:Receipt Number: #{@receipt_number}".rstrip out_str << "\n:Document Number: #{@document_number}".rstrip out_str << "\n:Reference Numbers: #{reference_numbers}".rstrip out_str << "\n:Purchase Date: #{@date}".rstrip out_str << "\n:Due Date: #{@due_date}".rstrip out_str << "\n:Payment Date: #{@payment_date}".rstrip out_str << "\n:Total Net: #{@total_net}".rstrip out_str << "\n:Total Amount: #{@total_amount}".rstrip out_str << "\n:Taxes:#{@taxes}".rstrip out_str << "\n:Supplier Payment Details: #{supplier_payment_details}".rstrip out_str << "\n:Supplier Name: #{@supplier_name}".rstrip out_str << "\n:Supplier Company Registrations: #{supplier_company_registrations}".rstrip out_str << "\n:Supplier Address: #{@supplier_address}".rstrip out_str << "\n:Supplier Phone Number: #{@supplier_phone_number}".rstrip out_str << "\n:Customer Name: #{@customer_name}".rstrip out_str << "\n:Supplier Website: #{@supplier_website}".rstrip out_str << "\n:Supplier Email: #{@supplier_email}".rstrip out_str << "\n:Customer Company Registrations: #{customer_company_registrations}".rstrip out_str << "\n:Customer Address: #{@customer_address}".rstrip out_str << "\n:Customer ID: #{@customer_id}".rstrip out_str << "\n:Shipping Address: #{@shipping_address}".rstrip out_str << "\n:Billing Address: #{@billing_address}".rstrip out_str << "\n:Document Type: #{@document_type}".rstrip out_str << "\n:Document Type Extended: #{@document_type_extended}".rstrip out_str << "\n:Purchase Subcategory: #{@subcategory}".rstrip out_str << "\n:Purchase Category: #{@category}".rstrip out_str << "\n:Total Tax: #{@total_tax}".rstrip out_str << "\n:Tip and Gratuity: #{@tip}".rstrip out_str << "\n:Purchase Time: #{@time}".rstrip out_str << "\n:Line Items:" out_str << line_items out_str[1..].to_s end |