mindee 3.19.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +28 -0
- data/README.md +42 -52
- data/Steepfile +31 -0
- data/bin/mindee.rb +30 -62
- data/docs/advanced_file_operations.md +111 -0
- data/docs/code_samples/bank_account_details_v1.txt +5 -0
- data/docs/code_samples/bank_account_details_v2.txt +5 -0
- data/docs/code_samples/bank_check_v1.txt +5 -0
- data/docs/code_samples/{us_driver_license_v1.txt → bank_statement_fr_v2_async.txt} +6 -1
- data/docs/code_samples/barcode_reader_v1.txt +5 -0
- data/docs/code_samples/bill_of_lading_v1_async.txt +6 -1
- data/docs/code_samples/business_card_v1_async.txt +6 -1
- data/docs/code_samples/carte_grise_v1.txt +5 -0
- data/docs/code_samples/cropper_v1.txt +5 -0
- data/docs/code_samples/default.txt +8 -2
- data/docs/code_samples/default_async.txt +7 -2
- data/docs/code_samples/delivery_notes_v1_async.txt +6 -1
- data/docs/code_samples/driver_license_v1_async.txt +6 -1
- data/docs/code_samples/energy_bill_fra_v1_async.txt +6 -1
- data/docs/code_samples/expense_receipts_v5.txt +7 -1
- data/docs/code_samples/expense_receipts_v5_async.txt +6 -1
- data/docs/code_samples/financial_document_v1.txt +7 -1
- data/docs/code_samples/financial_document_v1_async.txt +6 -1
- data/docs/code_samples/french_healthcard_v1_async.txt +6 -1
- data/docs/code_samples/idcard_fr_v1.txt +5 -0
- data/docs/code_samples/idcard_fr_v2.txt +5 -0
- data/docs/code_samples/ind_passport_v1_async.txt +6 -1
- data/docs/code_samples/international_id_v2_async.txt +6 -1
- data/docs/code_samples/invoice_splitter_v1_async.txt +6 -1
- data/docs/code_samples/invoices_v4.txt +7 -1
- data/docs/code_samples/invoices_v4_async.txt +6 -1
- data/docs/code_samples/license_plates_v1.txt +5 -0
- data/docs/code_samples/multi_receipts_detector_v1.txt +5 -0
- data/docs/code_samples/nutrition_facts_v1_async.txt +6 -1
- data/docs/code_samples/passport_v1.txt +5 -0
- data/docs/code_samples/payslip_fra_v2_async.txt +6 -1
- data/docs/code_samples/payslip_fra_v3_async.txt +6 -1
- data/docs/code_samples/resume_v1_async.txt +6 -1
- data/docs/code_samples/us_healthcare_cards_v1_async.txt +6 -1
- data/docs/code_samples/us_mail_v3_async.txt +6 -1
- data/docs/code_samples/us_w9_v1.txt +5 -0
- data/docs/getting_started.md +50 -118
- data/docs/{barcode_reader_v1.md → global_products/barcode_reader_v1.md} +26 -9
- data/docs/{bill_of_lading_v1.md → global_products/bill_of_lading_v1.md} +62 -37
- data/docs/{business_card_v1.md → global_products/business_card_v1.md} +35 -10
- data/docs/{cropper_v1.md → global_products/cropper_v1.md} +32 -13
- data/docs/{delivery_notes_v1.md → global_products/delivery_notes_v1.md} +35 -10
- data/docs/{driver_license_v1.md → global_products/driver_license_v1.md} +65 -9
- data/docs/{expense_receipts_v5.md → global_products/expense_receipts_v5.md} +57 -21
- data/docs/{financial_document_v1.md → global_products/financial_document_v1.md} +70 -33
- data/docs/{international_id_v2.md → global_products/international_id_v2.md} +39 -13
- data/docs/{invoice_splitter_v1.md → global_products/invoice_splitter_v1.md} +25 -6
- data/docs/{invoices_v4.md → global_products/invoices_v4.md} +70 -33
- data/docs/{multi_receipts_detector_v1.md → global_products/multi_receipts_detector_v1.md} +32 -13
- data/docs/{nutrition_facts_v1.md → global_products/nutrition_facts_v1.md} +103 -78
- data/docs/{passport_v1.md → global_products/passport_v1.md} +26 -9
- data/docs/{resume_v1.md → global_products/resume_v1.md} +72 -46
- data/docs/{generated_v1.md → global_products/universal.md} +39 -19
- data/docs/global_products.md +6 -0
- data/docs/loading_a_document.md +316 -0
- data/docs/{bank_account_details_v2.md → localized_products/bank_account_details_v2.md} +24 -7
- data/docs/{bank_check_v1.md → localized_products/bank_check_v1.md} +37 -18
- data/docs/localized_products/bank_statement_fr_v2.md +269 -0
- data/docs/{carte_grise_v1.md → localized_products/carte_grise_v1.md} +25 -8
- data/docs/{energy_bill_fra_v1.md → localized_products/energy_bill_fra_v1.md} +70 -45
- data/docs/{french_healthcard_v1.md → localized_products/french_healthcard_v1.md} +36 -11
- data/docs/{idcard_fr_v2.md → localized_products/idcard_fr_v2.md} +34 -16
- data/docs/{ind_passport_v1.md → localized_products/ind_passport_v1.md} +37 -11
- data/docs/{license_plates_v1.md → localized_products/license_plates_v1.md} +25 -8
- data/docs/{payslip_fra_v3.md → localized_products/payslip_fra_v3.md} +80 -55
- data/docs/{us_healthcare_cards_v1.md → localized_products/us_healthcare_cards_v1.md} +37 -12
- data/docs/{us_mail_v3.md → localized_products/us_mail_v3.md} +49 -24
- data/docs/{us_w9_v1.md → localized_products/us_w9_v1.md} +64 -45
- data/docs/localized_products.md +6 -0
- data/examples/auto_invoice_splitter_extraction.rb +5 -5
- data/examples/auto_multi_receipts_detector_extraction.rb +4 -5
- data/lib/mindee/client.rb +354 -209
- data/lib/mindee/errors/mindee_error.rb +17 -0
- data/lib/mindee/errors/mindee_http_error.rb +36 -0
- data/lib/mindee/errors/mindee_input_error.rb +30 -0
- data/lib/mindee/errors.rb +5 -0
- data/lib/mindee/extraction/multi_receipts_extractor.rb +28 -1
- data/lib/mindee/extraction.rb +0 -3
- data/lib/mindee/geometry/polygon.rb +1 -1
- data/lib/mindee/geometry/utils.rb +1 -1
- data/lib/mindee/http/endpoint.rb +48 -40
- data/lib/mindee/http/{error.rb → http_error_handler.rb} +5 -35
- data/lib/mindee/http/response_validation.rb +2 -2
- data/lib/mindee/http/workflow_endpoint.rb +12 -12
- data/lib/mindee/http.rb +1 -1
- data/lib/mindee/{extraction/common → image}/extracted_image.rb +22 -18
- data/lib/mindee/{extraction/common → image}/image_extractor.rb +20 -78
- data/lib/mindee/image/image_utils.rb +68 -7
- data/lib/mindee/image.rb +2 -0
- data/lib/mindee/input/local_response.rb +8 -8
- data/lib/mindee/input/sources/base64_input_source.rb +6 -6
- data/lib/mindee/input/sources/bytes_input_source.rb +3 -3
- data/lib/mindee/input/sources/file_input_source.rb +3 -3
- data/lib/mindee/input/sources/local_input_source.rb +43 -41
- data/lib/mindee/input/sources/path_input_source.rb +3 -3
- data/lib/mindee/input/sources/url_input_source.rb +11 -8
- data/lib/mindee/logging/logger.rb +16 -0
- data/lib/mindee/logging.rb +3 -0
- data/lib/mindee/parsing/common/api_request.rb +36 -0
- data/lib/mindee/parsing/common/api_response.rb +6 -96
- data/lib/mindee/parsing/common/document.rb +12 -8
- data/lib/mindee/parsing/common/execution.rb +4 -2
- data/lib/mindee/parsing/common/execution_priority.rb +6 -0
- data/lib/mindee/parsing/common/extras/cropper_extra.rb +2 -1
- data/lib/mindee/parsing/common/extras/extras.rb +9 -4
- data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +1 -0
- data/lib/mindee/parsing/common/inference.rb +23 -4
- data/lib/mindee/parsing/common/job.rb +46 -0
- data/lib/mindee/parsing/common/ocr/mvision_v1.rb +6 -6
- data/lib/mindee/parsing/common/ocr/ocr.rb +29 -29
- data/lib/mindee/parsing/common/page.rb +5 -3
- data/lib/mindee/parsing/common/prediction.rb +2 -0
- data/lib/mindee/parsing/common/workflow_response.rb +28 -0
- data/lib/mindee/parsing/common.rb +3 -0
- data/lib/mindee/parsing/standard/abstract_field.rb +72 -0
- data/lib/mindee/parsing/standard/amount_field.rb +2 -2
- data/lib/mindee/parsing/standard/base_field.rb +5 -84
- data/lib/mindee/parsing/standard/boolean_field.rb +4 -3
- data/lib/mindee/parsing/standard/classification_field.rb +1 -1
- data/lib/mindee/parsing/standard/company_registration_field.rb +7 -2
- data/lib/mindee/parsing/standard/date_field.rb +2 -2
- data/lib/mindee/parsing/standard/feature_field.rb +24 -0
- data/lib/mindee/parsing/standard/payment_details_field.rb +2 -2
- data/lib/mindee/parsing/standard/position_field.rb +3 -1
- data/lib/mindee/parsing/standard/string_field.rb +1 -1
- data/lib/mindee/parsing/standard/tax_field.rb +1 -1
- data/lib/mindee/parsing/standard.rb +1 -0
- data/lib/mindee/parsing/{generated/generated_list_field.rb → universal/universal_list_field.rb} +12 -12
- data/lib/mindee/parsing/{generated/generated_object_field.rb → universal/universal_object_field.rb} +23 -14
- data/lib/mindee/parsing/universal.rb +4 -0
- data/lib/mindee/parsing.rb +1 -2
- data/lib/mindee/{extraction/pdf_extractor → pdf}/extracted_pdf.rb +15 -12
- data/lib/mindee/pdf/pdf_compressor.rb +12 -10
- data/lib/mindee/{extraction/pdf_extractor → pdf}/pdf_extractor.rb +20 -17
- data/lib/mindee/pdf/pdf_processor.rb +12 -22
- data/lib/mindee/pdf/pdf_tools.rb +52 -6
- data/lib/mindee/pdf.rb +2 -0
- data/lib/mindee/product/.rubocop.yml +3 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +9 -3
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +5 -5
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +9 -5
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +9 -3
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +13 -7
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_items.rb +62 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +44 -17
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +1 -1
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +9 -5
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +1 -1
- data/lib/mindee/product/business_card/business_card_v1.rb +9 -3
- data/lib/mindee/product/business_card/business_card_v1_document.rb +40 -13
- data/lib/mindee/product/business_card/business_card_v1_page.rb +9 -5
- data/lib/mindee/product/cropper/cropper_v1.rb +10 -4
- data/lib/mindee/product/cropper/cropper_v1_page.rb +11 -7
- data/lib/mindee/product/delivery_note/delivery_note_v1.rb +9 -3
- data/lib/mindee/product/delivery_note/delivery_note_v1_document.rb +29 -8
- data/lib/mindee/product/delivery_note/delivery_note_v1_page.rb +9 -5
- data/lib/mindee/product/driver_license/driver_license_v1.rb +9 -3
- data/lib/mindee/product/driver_license/driver_license_v1_document.rb +44 -14
- data/lib/mindee/product/driver_license/driver_license_v1_page.rb +9 -5
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +9 -3
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +3 -3
- data/lib/mindee/product/eu/license_plate/license_plate_v1_page.rb +9 -5
- data/lib/mindee/product/financial_document/financial_document_v1.rb +9 -3
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +110 -42
- data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +21 -11
- data/lib/mindee/product/financial_document/financial_document_v1_line_items.rb +62 -0
- data/lib/mindee/product/financial_document/financial_document_v1_page.rb +9 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +9 -3
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +7 -4
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rb +9 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +9 -3
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +1 -1
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +11 -5
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb +9 -5
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2.rb +47 -0
- data/lib/mindee/product/fr/bank_statement/{bank_statement_v1_document.rb → bank_statement_v2_document.rb} +62 -26
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2_page.rb +38 -0
- data/lib/mindee/product/fr/bank_statement/{bank_statement_v1_transaction.rb → bank_statement_v2_transaction.rb} +17 -6
- data/lib/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rb +54 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +9 -3
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +51 -42
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +9 -5
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +9 -3
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +56 -30
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usages.rb +65 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +1 -1
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +9 -5
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb +65 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +13 -7
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contributions.rb +65 -0
- data/lib/mindee/product/fr/health_card/health_card_v1.rb +9 -3
- data/lib/mindee/product/fr/health_card/health_card_v1_document.rb +15 -6
- data/lib/mindee/product/fr/health_card/health_card_v1_page.rb +9 -5
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +9 -3
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +33 -12
- data/lib/mindee/product/fr/id_card/id_card_v1_page.rb +14 -7
- data/lib/mindee/product/fr/id_card/id_card_v2.rb +9 -3
- data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +50 -17
- data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +18 -8
- data/lib/mindee/product/fr/payslip/payslip_v2.rb +9 -3
- data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +29 -14
- data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +3 -2
- data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +9 -5
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +33 -11
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +13 -4
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +13 -7
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb +63 -0
- data/lib/mindee/product/fr/payslip/payslip_v3.rb +9 -3
- data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +31 -19
- data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +9 -5
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +13 -7
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_offs.rb +65 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +33 -11
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +1 -1
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +17 -9
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_details.rb +65 -0
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1.rb +9 -3
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +87 -24
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +9 -5
- data/lib/mindee/product/international_id/international_id_v2.rb +9 -3
- data/lib/mindee/product/international_id/international_id_v2_document.rb +62 -20
- data/lib/mindee/product/international_id/international_id_v2_page.rb +9 -5
- data/lib/mindee/product/invoice/invoice_v4.rb +9 -3
- data/lib/mindee/product/invoice/invoice_v4_document.rb +90 -36
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +21 -11
- data/lib/mindee/product/invoice/invoice_v4_line_items.rb +62 -0
- data/lib/mindee/product/invoice/invoice_v4_page.rb +9 -5
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +8 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +2 -2
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_page.rb +1 -1
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +9 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +3 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +9 -5
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +9 -3
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +58 -20
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +13 -7
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrients.rb +68 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +9 -5
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +3 -2
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +7 -4
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +7 -4
- data/lib/mindee/product/passport/passport_v1.rb +9 -3
- data/lib/mindee/product/passport/passport_v1_document.rb +37 -13
- data/lib/mindee/product/passport/passport_v1_page.rb +9 -5
- data/lib/mindee/product/receipt/receipt_v5.rb +9 -3
- data/lib/mindee/product/receipt/receipt_v5_document.rb +54 -24
- data/lib/mindee/product/receipt/receipt_v5_line_item.rb +13 -7
- data/lib/mindee/product/receipt/receipt_v5_line_items.rb +54 -0
- data/lib/mindee/product/receipt/receipt_v5_page.rb +9 -5
- data/lib/mindee/product/resume/resume_v1.rb +9 -3
- data/lib/mindee/product/resume/resume_v1_certificate.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_certificates.rb +58 -0
- data/lib/mindee/product/resume/resume_v1_document.rb +60 -47
- data/lib/mindee/product/resume/resume_v1_education.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_educations.rb +64 -0
- data/lib/mindee/product/resume/resume_v1_language.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_languages.rb +54 -0
- data/lib/mindee/product/resume/resume_v1_page.rb +9 -5
- data/lib/mindee/product/resume/resume_v1_professional_experience.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_professional_experiences.rb +68 -0
- data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_social_networks_urls.rb +54 -0
- data/lib/mindee/product/universal/universal.rb +46 -0
- data/lib/mindee/product/universal/universal_document.rb +32 -0
- data/lib/mindee/product/{generated/generated_v1_page.rb → universal/universal_page.rb} +14 -14
- data/lib/mindee/product/{generated/generated_v1_prediction.rb → universal/universal_prediction.rb} +32 -24
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +9 -3
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +20 -8
- data/lib/mindee/product/us/bank_check/bank_check_v1_page.rb +15 -8
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1.rb +9 -3
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +5 -3
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copays.rb +52 -0
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_document.rb +46 -19
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_page.rb +9 -5
- data/lib/mindee/product/us/us_mail/us_mail_v3.rb +9 -3
- data/lib/mindee/product/us/us_mail/us_mail_v3_document.rb +20 -12
- data/lib/mindee/product/us/us_mail/us_mail_v3_page.rb +9 -5
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb +2 -2
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rb +65 -0
- data/lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb +1 -1
- data/lib/mindee/product/us/w9/w9_v1.rb +10 -4
- data/lib/mindee/product/us/w9/w9_v1_page.rb +49 -18
- data/lib/mindee/product.rb +2 -8
- data/lib/mindee/version.rb +2 -2
- data/lib/mindee.rb +22 -9
- data/mindee.gemspec +19 -17
- data/sig/custom/marcel.rbs +3 -0
- data/sig/custom/mini_magick.rbs +24 -0
- data/sig/custom/net_http.rbs +34 -0
- data/sig/custom/origami.rbs +54 -0
- data/sig/mindee/client.rbs +63 -0
- data/sig/mindee/errors/mindee_error.rbs +13 -0
- data/sig/mindee/errors/mindee_http_error.rbs +16 -0
- data/sig/mindee/errors/mindee_input_error.rbs +17 -0
- data/sig/mindee/extraction/multi_receipts_extractor.rbs +6 -0
- data/sig/mindee/geometry/min_max.rbs +10 -0
- data/sig/mindee/geometry/point.rbs +13 -0
- data/sig/mindee/geometry/polygon.rbs +9 -0
- data/sig/mindee/geometry/quadrilateral.rbs +18 -0
- data/sig/mindee/geometry/utils.rbs +13 -0
- data/sig/mindee/http/endpoint.rbs +26 -0
- data/sig/mindee/http/http_error_handler.rbs +10 -0
- data/sig/mindee/http/response_validation.rbs +10 -0
- data/sig/mindee/http/workflow_endpoint.rbs +14 -0
- data/sig/mindee/image/extracted_image.rbs +15 -0
- data/sig/mindee/image/image_compressor.rbs +8 -0
- data/sig/mindee/image/image_extractor.rbs +13 -0
- data/sig/mindee/image/image_utils.rbs +19 -0
- data/sig/mindee/input/local_response.rbs +13 -0
- data/sig/mindee/input/sources/base64_input_source.rbs +11 -0
- data/sig/mindee/input/sources/bytes_input_source.rbs +10 -0
- data/sig/mindee/input/sources/file_input_source.rbs +10 -0
- data/sig/mindee/input/sources/local_input_source.rbs +24 -0
- data/sig/mindee/input/sources/path_input_source.rbs +10 -0
- data/sig/mindee/input/sources/url_input_source.rbs +20 -0
- data/sig/mindee/logging/logger.rbs +9 -0
- data/sig/mindee/parsing/common/api_request.rbs +15 -0
- data/sig/mindee/parsing/common/api_response.rbs +27 -0
- data/sig/mindee/parsing/common/document.rbs +20 -0
- data/sig/mindee/parsing/common/execution.rbs +23 -0
- data/sig/mindee/parsing/common/execution_file.rbs +12 -0
- data/sig/mindee/parsing/common/execution_priority.rbs +13 -0
- data/sig/mindee/parsing/common/extras/cropper_extra.rbs +14 -0
- data/sig/mindee/parsing/common/extras/extras.rbs +18 -0
- data/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs +15 -0
- data/sig/mindee/parsing/common/inference.rbs +19 -0
- data/sig/mindee/parsing/common/job.rbs +16 -0
- data/sig/mindee/parsing/common/ocr/mvision_v1.rbs +15 -0
- data/sig/mindee/parsing/common/ocr/ocr.rbs +39 -0
- data/sig/mindee/parsing/common/orientation.rbs +12 -0
- data/sig/mindee/parsing/common/page.rbs +15 -0
- data/sig/mindee/parsing/common/prediction.rbs +11 -0
- data/sig/mindee/parsing/common/product.rbs +13 -0
- data/sig/mindee/parsing/common/workflow_response.rbs +13 -0
- data/sig/mindee/parsing/standard/abstract_field.rbs +19 -0
- data/sig/mindee/parsing/standard/amount_field.rbs +12 -0
- data/sig/mindee/parsing/standard/base_field.rbs +12 -0
- data/sig/mindee/parsing/standard/boolean_field.rbs +12 -0
- data/sig/mindee/parsing/standard/classification_field.rbs +10 -0
- data/sig/mindee/parsing/standard/company_registration_field.rbs +14 -0
- data/sig/mindee/parsing/standard/date_field.rbs +14 -0
- data/sig/mindee/parsing/standard/feature_field.rbs +10 -0
- data/sig/mindee/parsing/standard/locale_field.rbs +16 -0
- data/sig/mindee/parsing/standard/payment_details_field.rbs +15 -0
- data/sig/mindee/parsing/standard/position_field.rbs +17 -0
- data/sig/mindee/parsing/standard/string_field.rbs +12 -0
- data/sig/mindee/parsing/standard/tax_field.rbs +23 -0
- data/sig/mindee/parsing/universal/universal_list_field.rbs +17 -0
- data/sig/mindee/parsing/universal/universal_object_field.rbs +23 -0
- data/sig/mindee/pdf/extracted_pdf.rbs +15 -0
- data/sig/mindee/pdf/pdf_compressor.rbs +15 -0
- data/sig/mindee/pdf/pdf_extractor.rbs +16 -0
- data/sig/mindee/pdf/pdf_processor.rbs +12 -0
- data/sig/mindee/pdf/pdf_tools.rbs +23 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs +11 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs +14 -0
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs +11 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs +14 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs +19 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_items.rbs +13 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs +25 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs +15 -0
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs +15 -0
- data/sig/mindee/product/business_card/business_card_v1.rbs +11 -0
- data/sig/mindee/product/business_card/business_card_v1_document.rbs +23 -0
- data/sig/mindee/product/business_card/business_card_v1_page.rbs +15 -0
- data/sig/mindee/product/cropper/cropper_v1.rbs +11 -0
- data/sig/mindee/product/cropper/cropper_v1_document.rbs +12 -0
- data/sig/mindee/product/cropper/cropper_v1_page.rbs +16 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1.rbs +11 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs +19 -0
- data/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs +15 -0
- data/sig/mindee/product/driver_license/driver_license_v1.rbs +11 -0
- data/sig/mindee/product/driver_license/driver_license_v1_document.rbs +25 -0
- data/sig/mindee/product/driver_license/driver_license_v1_page.rbs +15 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1.rbs +13 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1_document.rbs +15 -0
- data/sig/mindee/product/eu/license_plate/license_plate_v1_page.rbs +17 -0
- data/sig/mindee/product/financial_document/financial_document_v1.rbs +11 -0
- data/sig/mindee/product/financial_document/financial_document_v1_document.rbs +46 -0
- data/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs +21 -0
- data/sig/mindee/product/financial_document/financial_document_v1_line_items.rbs +13 -0
- data/sig/mindee/product/financial_document/financial_document_v1_page.rbs +15 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs +13 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs +13 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs +17 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs +18 -0
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs +13 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs +29 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs +18 -0
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_transactions.rbs +15 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs +13 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs +55 -0
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs +13 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs +34 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usages.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs +16 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rbs +15 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs +21 -0
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contributions.rbs +15 -0
- data/sig/mindee/product/fr/health_card/health_card_v1.rbs +13 -0
- data/sig/mindee/product/fr/health_card/health_card_v1_document.rbs +18 -0
- data/sig/mindee/product/fr/health_card/health_card_v1_page.rbs +17 -0
- data/sig/mindee/product/fr/id_card/id_card_v1.rbs +13 -0
- data/sig/mindee/product/fr/id_card/id_card_v1_document.rbs +24 -0
- data/sig/mindee/product/fr/id_card/id_card_v1_page.rbs +18 -0
- data/sig/mindee/product/fr/id_card/id_card_v2.rbs +13 -0
- data/sig/mindee/product/fr/id_card/id_card_v2_document.rbs +29 -0
- data/sig/mindee/product/fr/id_card/id_card_v2_page.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2.rbs +13 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_document.rbs +24 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_page.rbs +17 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs +23 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs +18 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs +19 -0
- data/sig/mindee/product/fr/payslip/payslip_v2_salary_details.rbs +15 -0
- data/sig/mindee/product/fr/payslip/payslip_v3.rbs +13 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs +16 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_document.rbs +26 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_page.rbs +17 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_paid_time_offs.rbs +15 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs +23 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs +18 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs +20 -0
- data/sig/mindee/product/fr/payslip/payslip_v3_salary_details.rbs +15 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs +13 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs +37 -0
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs +17 -0
- data/sig/mindee/product/international_id/international_id_v2.rbs +11 -0
- data/sig/mindee/product/international_id/international_id_v2_document.rbs +29 -0
- data/sig/mindee/product/international_id/international_id_v2_page.rbs +15 -0
- data/sig/mindee/product/invoice/invoice_v4.rbs +11 -0
- data/sig/mindee/product/invoice/invoice_v4_document.rbs +40 -0
- data/sig/mindee/product/invoice/invoice_v4_line_item.rbs +21 -0
- data/sig/mindee/product/invoice/invoice_v4_line_items.rbs +13 -0
- data/sig/mindee/product/invoice/invoice_v4_page.rbs +15 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs +14 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs +19 -0
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs +13 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs +11 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs +13 -0
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs +11 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs +28 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs +18 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrients.rbs +13 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs +13 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs +15 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs +14 -0
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs +14 -0
- data/sig/mindee/product/passport/passport_v1.rbs +11 -0
- data/sig/mindee/product/passport/passport_v1_document.rbs +23 -0
- data/sig/mindee/product/passport/passport_v1_page.rbs +15 -0
- data/sig/mindee/product/receipt/receipt_v5.rbs +11 -0
- data/sig/mindee/product/receipt/receipt_v5_document.rbs +31 -0
- data/sig/mindee/product/receipt/receipt_v5_line_item.rbs +17 -0
- data/sig/mindee/product/receipt/receipt_v5_line_items.rbs +13 -0
- data/sig/mindee/product/receipt/receipt_v5_page.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1.rbs +11 -0
- data/sig/mindee/product/resume/resume_v1_certificate.rbs +17 -0
- data/sig/mindee/product/resume/resume_v1_certificates.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_document.rbs +39 -0
- data/sig/mindee/product/resume/resume_v1_education.rbs +20 -0
- data/sig/mindee/product/resume/resume_v1_educations.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_language.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_languages.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_page.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_professional_experience.rbs +22 -0
- data/sig/mindee/product/resume/resume_v1_professional_experiences.rbs +13 -0
- data/sig/mindee/product/resume/resume_v1_social_networks_url.rbs +15 -0
- data/sig/mindee/product/resume/resume_v1_social_networks_urls.rbs +13 -0
- data/sig/mindee/product/universal/universal.rbs +14 -0
- data/sig/mindee/product/universal/universal_document.rbs +10 -0
- data/sig/mindee/product/universal/universal_page.rbs +14 -0
- data/sig/mindee/product/universal/universal_prediction.rbs +19 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1.rbs +13 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs +20 -0
- data/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs +19 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs +13 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs +17 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copays.rbs +15 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs +28 -0
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs +17 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3.rbs +13 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs +21 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs +17 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs +23 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rbs +15 -0
- data/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs +18 -0
- data/sig/mindee/product/us/w9/w9_v1.rbs +13 -0
- data/sig/mindee/product/us/w9/w9_v1_document.rbs +14 -0
- data/sig/mindee/product/us/w9/w9_v1_page.rbs +29 -0
- data/sig/mindee/version.rbs +6 -0
- data/sig/mindee.rbs +59 -0
- metadata +395 -103
- data/docs/bank_statement_fr_v1.md +0 -178
- data/docs/code_samples/bank_statement_fr_v1_async.txt +0 -19
- data/docs/code_samples/custom_v1.txt +0 -33
- data/docs/code_samples/eu_driver_license_v1.txt +0 -19
- data/docs/code_samples/expense_receipts_v4.txt +0 -19
- data/docs/code_samples/proof_of_address_v1.txt +0 -19
- data/docs/code_samples/us_mail_v2_async.txt +0 -19
- data/docs/code_samples/workflow_execution.txt +0 -29
- data/docs/custom_v1.md +0 -111
- data/docs/payslip_fra_v2.md +0 -294
- data/lib/mindee/extraction/common.rb +0 -4
- data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +0 -32
- data/lib/mindee/extraction/pdf_extractor.rb +0 -4
- data/lib/mindee/extraction/tax_extractor/ocr_extractor.rb +0 -110
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +0 -338
- data/lib/mindee/extraction/tax_extractor.rb +0 -3
- data/lib/mindee/parsing/custom/classification_field.rb +0 -28
- data/lib/mindee/parsing/custom/list_field.rb +0 -78
- data/lib/mindee/parsing/custom.rb +0 -4
- data/lib/mindee/parsing/generated.rb +0 -4
- data/lib/mindee/product/custom/custom_v1.rb +0 -36
- data/lib/mindee/product/custom/custom_v1_document.rb +0 -60
- data/lib/mindee/product/custom/custom_v1_page.rb +0 -32
- data/lib/mindee/product/eu/driver_license/driver_license_v1.rb +0 -41
- data/lib/mindee/product/eu/driver_license/driver_license_v1_document.rb +0 -88
- data/lib/mindee/product/eu/driver_license/driver_license_v1_page.rb +0 -53
- data/lib/mindee/product/fr/bank_statement/bank_statement_v1.rb +0 -41
- data/lib/mindee/product/fr/bank_statement/bank_statement_v1_page.rb +0 -34
- data/lib/mindee/product/generated/generated_v1.rb +0 -38
- data/lib/mindee/product/generated/generated_v1_document.rb +0 -35
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +0 -39
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +0 -83
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_page.rb +0 -32
- data/lib/mindee/product/receipt/receipt_v4.rb +0 -36
- data/lib/mindee/product/receipt/receipt_v4_document.rb +0 -86
- data/lib/mindee/product/receipt/receipt_v4_page.rb +0 -32
- data/lib/mindee/product/us/driver_license/driver_license_v1.rb +0 -41
- data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +0 -113
- data/lib/mindee/product/us/driver_license/driver_license_v1_page.rb +0 -53
- data/lib/mindee/product/us/us_mail/us_mail_v2.rb +0 -41
- data/lib/mindee/product/us/us_mail/us_mail_v2_document.rb +0 -100
- data/lib/mindee/product/us/us_mail/us_mail_v2_page.rb +0 -34
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +0 -105
- data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +0 -66
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pdf-reader'
|
4
|
+
# Shorthand for pdf-reader's PDF namespace, to avoid mixups with the local Origami fork.
|
4
5
|
PDFReader = PDF
|
5
6
|
|
6
7
|
module Mindee
|
@@ -8,20 +9,21 @@ module Mindee
|
|
8
9
|
# Image compressor module to handle PDF compression.
|
9
10
|
module PDFCompressor
|
10
11
|
# Compresses each page of a provided PDF stream. Skips if force_source_text isn't set and source text is detected.
|
12
|
+
# @param pdf_data [StringIO] StringIO handle of the file.
|
11
13
|
# @param quality [Integer] Compression quality (70-100 for most JPG images in the test dataset).
|
12
|
-
# @param force_source_text_compression [
|
13
|
-
# @param disable_source_text [
|
14
|
+
# @param force_source_text_compression [bool] If true, attempts to re-write detected text.
|
15
|
+
# @param disable_source_text [bool] If true, doesn't re-apply source text to the original PDF.
|
14
16
|
def self.compress_pdf(pdf_data, quality: 85, force_source_text_compression: false, disable_source_text: true)
|
15
17
|
if PDFTools.source_text?(pdf_data)
|
16
18
|
if force_source_text_compression
|
17
19
|
if disable_source_text
|
18
|
-
|
20
|
+
logger.warn('Re-writing PDF source-text is an EXPERIMENTAL feature.')
|
19
21
|
else
|
20
|
-
|
21
|
-
|
22
|
+
logger.warn('Source-file contains text, but disable_source_text flag is ignored. ' \
|
23
|
+
'Resulting file will not contain any embedded text.')
|
22
24
|
end
|
23
25
|
else
|
24
|
-
|
26
|
+
logger.warn('Source-text detected in input PDF. Aborting operation.')
|
25
27
|
return pdf_data
|
26
28
|
end
|
27
29
|
end
|
@@ -43,18 +45,18 @@ module Mindee
|
|
43
45
|
# @return [Array<Origami::Page>] Processed pages.
|
44
46
|
def self.process_pdf_pages(pdf, quality)
|
45
47
|
pdf.pages.map.with_index do |page, index|
|
46
|
-
|
48
|
+
retrieved_page = Mindee::PDF::PDFProcessor.get_page(pdf, index)
|
49
|
+
process_pdf_page(retrieved_page, index, quality, page[:MediaBox])
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
50
53
|
# Creates the output PDF with processed pages.
|
51
|
-
# @param pages [Array] Processed pages.
|
52
|
-
# @param disable_source_text [
|
54
|
+
# @param pages [Array<Origami::Page>] Processed pages.
|
55
|
+
# @param disable_source_text [bool] Whether to disable source text.
|
53
56
|
# @param pdf_data [StringIO] Original PDF data.
|
54
57
|
# @return [Origami::PDF] Output PDF object.
|
55
58
|
def self.create_output_pdf(pages, disable_source_text, pdf_data)
|
56
59
|
output_pdf = Origami::PDF.new
|
57
|
-
# NOTE: Page order and XObject handling require adjustment due to origami adding the last page first.
|
58
60
|
pages.rotate!(1) if pages.count >= 2
|
59
61
|
|
60
62
|
inject_text(pdf_data, pages) unless disable_source_text
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
module Mindee
|
4
4
|
# Pdf Extraction Module.
|
5
|
-
module
|
5
|
+
module PDF
|
6
6
|
# Pdf Extraction class.
|
7
|
-
module
|
7
|
+
module PDFExtractor
|
8
8
|
# Pdf extraction class.
|
9
|
-
class
|
9
|
+
class PDFExtractor
|
10
10
|
# @param local_input [Mindee::Input::Source::LocalInputSource]
|
11
11
|
def initialize(local_input)
|
12
12
|
@filename = local_input.filename
|
13
13
|
if local_input.pdf?
|
14
14
|
@source_pdf = local_input.io_stream
|
15
15
|
else
|
16
|
-
pdf_image =
|
16
|
+
pdf_image = Image::ImageExtractor.attach_image_as_new_file(local_input.io_stream)
|
17
17
|
io_buffer = StringIO.new
|
18
18
|
pdf_image.save(io_buffer)
|
19
19
|
|
@@ -24,40 +24,43 @@ module Mindee
|
|
24
24
|
# Retrieves the page count for the Pdf object.
|
25
25
|
# @return [Integer]
|
26
26
|
def page_count
|
27
|
-
Mindee::PDF::
|
27
|
+
Mindee::PDF::PDFProcessor.open_pdf(@source_pdf).pages.size
|
28
28
|
end
|
29
29
|
|
30
30
|
# Creates a new Pdf from pages and save it into a buffer.
|
31
31
|
# @param page_indexes [Array<Integer>] List of page number to use for merging in the original Pdf.
|
32
32
|
# @return [StreamIO] The buffer containing the new Pdf.
|
33
33
|
def cut_pages(page_indexes)
|
34
|
-
options = {
|
35
|
-
|
36
|
-
|
34
|
+
options = PageOptions.new(params: {
|
35
|
+
page_indexes: page_indexes,
|
36
|
+
})
|
37
37
|
|
38
|
-
Mindee::PDF::
|
38
|
+
Mindee::PDF::PDFProcessor.parse(@source_pdf, options)
|
39
39
|
end
|
40
40
|
|
41
41
|
# Extract the sub-documents from the main pdf, based on the given list of page indexes.
|
42
42
|
# @param page_indexes [Array<Array<Integer>>] List of page number to use for merging in the original Pdf.
|
43
|
-
# @return [Array<Mindee::
|
43
|
+
# @return [Array<Mindee::PDF::PDFExtractor::ExtractedPDF>] The buffer containing the new Pdf.
|
44
44
|
def extract_sub_documents(page_indexes)
|
45
45
|
extracted_pdfs = []
|
46
46
|
extension = File.extname(@filename)
|
47
47
|
basename = File.basename(@filename, extension)
|
48
48
|
page_indexes.each do |page_index_list|
|
49
49
|
if page_index_list.empty? || page_index_list.nil?
|
50
|
-
raise "Empty indexes aren't allowed for extraction #{page_index_list}"
|
50
|
+
raise Errors::MindeePDFError, "Empty indexes aren't allowed for extraction #{page_index_list}"
|
51
51
|
end
|
52
52
|
|
53
53
|
page_index_list.each do |page_index|
|
54
|
-
|
54
|
+
if (page_index > page_count) || page_index.negative?
|
55
|
+
raise Errors::MindeePDFError,
|
56
|
+
"Index #{page_index} is out of range."
|
57
|
+
end
|
55
58
|
end
|
56
59
|
formatted_max_index = format('%03d', page_index_list[page_index_list.length - 1] + 1).to_s
|
57
60
|
field_filename = "#{basename}_#{format('%03d',
|
58
61
|
(page_index_list[0] + 1))}-#{formatted_max_index}#{extension}"
|
59
|
-
extracted_pdf = Mindee::
|
60
|
-
|
62
|
+
extracted_pdf = Mindee::PDF::PDFExtractor::ExtractedPDF.new(cut_pages(page_index_list),
|
63
|
+
field_filename)
|
61
64
|
extracted_pdfs << extracted_pdf
|
62
65
|
end
|
63
66
|
extracted_pdfs
|
@@ -68,10 +71,10 @@ module Mindee
|
|
68
71
|
|
69
72
|
# Extracts invoices as complete PDFs from the document.
|
70
73
|
# @param page_indexes [Array<Array<Integer>, InvoiceSplitterV1PageGroup>]
|
71
|
-
# @param strict [
|
72
|
-
# @return [Array<Mindee::
|
74
|
+
# @param strict [bool]
|
75
|
+
# @return [Array<Mindee::PDF::PDFExtractor::ExtractedPDF>]
|
73
76
|
def extract_invoices(page_indexes, strict: false)
|
74
|
-
raise 'No indexes provided.' if page_indexes.empty?
|
77
|
+
raise Errors::MindeePDFError, 'No indexes provided.' if page_indexes.empty?
|
75
78
|
unless page_indexes[0].is_a?(Mindee::Product::InvoiceSplitter::InvoiceSplitterV1PageGroup)
|
76
79
|
return extract_sub_documents(page_indexes)
|
77
80
|
end
|
@@ -7,34 +7,24 @@ require_relative 'pdf_tools'
|
|
7
7
|
module Mindee
|
8
8
|
module PDF
|
9
9
|
# PDF document processing
|
10
|
-
module
|
10
|
+
module PDFProcessor
|
11
11
|
Origami::PDF.class_eval { include PDFTools }
|
12
|
-
# Default options for pdf documents processing.
|
13
|
-
DEFAULT_OPTIONS = {
|
14
|
-
page_indexes: [0],
|
15
|
-
operation: :KEEP_ONLY,
|
16
|
-
on_min_pages: 0,
|
17
|
-
}.freeze
|
18
|
-
|
19
12
|
# @param io_stream [StreamIO]
|
20
|
-
# @param options [Hash]
|
13
|
+
# @param options [PageOptions, Hash]
|
21
14
|
# @return [StringIO]
|
22
15
|
def self.parse(io_stream, options)
|
23
|
-
options = DEFAULT_OPTIONS.merge(options)
|
24
|
-
|
25
16
|
current_pdf = open_pdf(io_stream)
|
26
17
|
pages_count = current_pdf.pages.size
|
27
|
-
return if options
|
18
|
+
return current_pdf.to_io_stream if options.on_min_pages.to_i > pages_count
|
28
19
|
|
29
20
|
all_pages = (0..pages_count - 1).to_a
|
30
21
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
pages_to_remove = indexes_from_remove(options[:page_indexes], all_pages)
|
22
|
+
if options.operation == :KEEP_ONLY
|
23
|
+
pages_to_remove = indexes_from_keep(options.page_indexes, all_pages)
|
24
|
+
elsif options.operation == :REMOVE
|
25
|
+
pages_to_remove = indexes_from_remove(options.page_indexes, all_pages)
|
36
26
|
else
|
37
|
-
raise "operation must be one of :KEEP_ONLY or :REMOVE, sent '#{
|
27
|
+
raise ArgumentError, "operation must be one of :KEEP_ONLY or :REMOVE, sent '#{options.operation}'"
|
38
28
|
end
|
39
29
|
|
40
30
|
current_pdf.delete_pages_at(pages_to_remove) if pages_to_remove.to_a != all_pages.to_a
|
@@ -55,7 +45,7 @@ module Mindee
|
|
55
45
|
all_pages.to_set - pages_to_keep
|
56
46
|
end
|
57
47
|
|
58
|
-
# @param page_indexes [Array]
|
48
|
+
# @param page_indexes [Array[Integer]]
|
59
49
|
# @param all_pages [Array]
|
60
50
|
def self.indexes_from_remove(page_indexes, all_pages)
|
61
51
|
pages_to_remove = Set.new
|
@@ -85,9 +75,9 @@ module Mindee
|
|
85
75
|
stream = StringIO.new
|
86
76
|
pdf_doc.save(stream)
|
87
77
|
|
88
|
-
options = {
|
89
|
-
|
90
|
-
|
78
|
+
options = PageOptions.new(params: {
|
79
|
+
page_indexes: [page_id - 1],
|
80
|
+
})
|
91
81
|
|
92
82
|
parse(stream, options)
|
93
83
|
end
|
data/lib/mindee/pdf/pdf_tools.rb
CHANGED
@@ -2,14 +2,23 @@
|
|
2
2
|
|
3
3
|
module Mindee
|
4
4
|
module PDF
|
5
|
-
#
|
5
|
+
# Collection of miscellaneous PDF operations,as well as some monkey-patching for Origami.
|
6
6
|
module PDFTools
|
7
|
-
#
|
7
|
+
# Converts the current PDF document into a binary-encoded StringIO stream.
|
8
|
+
#
|
9
|
+
# @param [Hash] params Optional settings to override default processing flags.
|
10
|
+
# - :delinearize [bool] (default: true) Whether to convert a linearized PDF to its full form.
|
11
|
+
# - :recompile [bool] (default: true) Whether to recompile the PDF after processing.
|
12
|
+
# - :decrypt [bool] (default: false) Whether to attempt to decrypt the PDF.
|
13
|
+
# - Other keys such as :intent, :rebuild_xrefs, :noindent, and :obfuscate may be modified automatically.
|
14
|
+
#
|
15
|
+
# @return [StringIO] A binary-encoded stream representing the processed PDF.
|
8
16
|
def to_io_stream(params = {})
|
9
17
|
options = {
|
10
18
|
delinearize: true,
|
11
19
|
recompile: true,
|
12
20
|
decrypt: false,
|
21
|
+
noindent: nil,
|
13
22
|
}
|
14
23
|
options.update(params)
|
15
24
|
|
@@ -21,7 +30,7 @@ module Mindee
|
|
21
30
|
end
|
22
31
|
load_all_objects unless @loaded
|
23
32
|
|
24
|
-
intents_as_pdfa1 if options[:intent] =~ %r{pdf[/-]?A1?/i}
|
33
|
+
intents_as_pdfa1 if options[:intent].to_s =~ %r{pdf[/-]?A1?/i}
|
25
34
|
delinearize! if options[:delinearize] && linearized?
|
26
35
|
compile(options) if options[:recompile]
|
27
36
|
|
@@ -33,7 +42,7 @@ module Mindee
|
|
33
42
|
# Checks a PDFs stream content for text operators
|
34
43
|
# See https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf page 243-251.
|
35
44
|
# @param [StringIO] stream Stream object from a PDFs page.
|
36
|
-
# @return [
|
45
|
+
# @return [bool] True if a text operator is found in the stream.
|
37
46
|
def self.stream_has_text?(stream)
|
38
47
|
data = stream.data
|
39
48
|
return false if data.nil? || data.empty?
|
@@ -43,8 +52,8 @@ module Mindee
|
|
43
52
|
end
|
44
53
|
|
45
54
|
# Checks whether the file has source_text. Sends false if the file isn't a PDF.
|
46
|
-
# @param [StringIO] pdf_data
|
47
|
-
# @return [
|
55
|
+
# @param [StringIO] pdf_data Abinary-encoded stream representing the PDF file.
|
56
|
+
# @return [bool] True if the pdf has source text, false otherwise.
|
48
57
|
def self.source_text?(pdf_data)
|
49
58
|
begin
|
50
59
|
pdf_data.rewind
|
@@ -70,11 +79,22 @@ module Mindee
|
|
70
79
|
false
|
71
80
|
end
|
72
81
|
|
82
|
+
# Creates an image XObject from the provided image.
|
83
|
+
#
|
84
|
+
# Converts the given image to a binary stream using Mindee's image utilities, then creates
|
85
|
+
# an Origami::Graphics::ImageXObject with a JPEG filter.
|
86
|
+
#
|
87
|
+
# @param [Minimagick::Image] image An image object with the necessary data and structure.
|
88
|
+
# @return [Origami::Graphics::ImageXObject] The created image XObject.
|
73
89
|
def self.create_xobject(image)
|
74
90
|
image_io = Mindee::Image::ImageUtils.image_to_stringio(image)
|
75
91
|
Origami::Graphics::ImageXObject.from_image_file(image_io, 'jpg')
|
76
92
|
end
|
77
93
|
|
94
|
+
# Sets properties on the provided image XObject based on image metadata.
|
95
|
+
#
|
96
|
+
# @param [Origami::Graphics::ImageXObject] xobject The image XObject to update.
|
97
|
+
# @param [Hash] image A hash containing image metadata (such as width, height, properties, etc.).
|
78
98
|
def self.set_xobject_properties(xobject, image)
|
79
99
|
xobject.dictionary[:BitsPerComponent] = 8
|
80
100
|
xobject.dictionary[:Filter] = determine_filter(image)
|
@@ -83,6 +103,10 @@ module Mindee
|
|
83
103
|
xobject.dictionary[:ColorSpace] = determine_colorspace(image)
|
84
104
|
end
|
85
105
|
|
106
|
+
# Determines the appropriate filter for an image based on its properties.
|
107
|
+
#
|
108
|
+
# @param [Hash] image The image data hash containing properties.
|
109
|
+
# @return [Symbol] One of :FlateDecode, :LZWDecode or :DCTDecode.
|
86
110
|
def self.determine_filter(image)
|
87
111
|
filter = image.data['properties']['filter']
|
88
112
|
case filter
|
@@ -92,6 +116,10 @@ module Mindee
|
|
92
116
|
end
|
93
117
|
end
|
94
118
|
|
119
|
+
# Determines the colorspace for an image based on its metadata.
|
120
|
+
#
|
121
|
+
# @param [Hash] image The image data hash.
|
122
|
+
# @return [Symbol] One of :DeviceCMYK, :DeviceGray or :DeviceRGB.
|
95
123
|
def self.determine_colorspace(image)
|
96
124
|
colorspace = image.data['colorspace']
|
97
125
|
case colorspace
|
@@ -101,17 +129,35 @@ module Mindee
|
|
101
129
|
end
|
102
130
|
end
|
103
131
|
|
132
|
+
# Adds a content stream to the specified PDF page to display an image XObject.
|
133
|
+
#
|
134
|
+
# @param [Origami::Page] page The PDF page to which content will be added.
|
135
|
+
# @param [String] xobject_name The name identifying the XObject.
|
136
|
+
# @param [Integer] width The width for the transformation matrix.
|
137
|
+
# @param [Integer] height The height for the transformation matrix.
|
104
138
|
def self.add_content_to_page(page, xobject_name, width, height)
|
105
139
|
content = "q\n#{width} 0 0 #{height} 0 0 cm\n/#{xobject_name} Do\nQ\n"
|
106
140
|
content_stream = Origami::Stream.new(content)
|
107
141
|
page.Contents = content_stream
|
108
142
|
end
|
109
143
|
|
144
|
+
# Sets the dimensions for the specified PDF page.
|
145
|
+
#
|
146
|
+
# @param [Origami::Page] page The PDF page whose dimensions are being set.
|
147
|
+
# @param [Numeric] width The target width of the page.
|
148
|
+
# @param [Numeric] height The target height of the page.
|
110
149
|
def self.set_page_dimensions(page, width, height)
|
111
150
|
page[:MediaBox] = [0, 0, width, height]
|
112
151
|
page[:CropBox] = [0, 0, width, height]
|
113
152
|
end
|
114
153
|
|
154
|
+
# Processes an image into an image XObject for PDF embedding.
|
155
|
+
#
|
156
|
+
# @param [Hash] image_data The raw image data.
|
157
|
+
# @param [Integer] image_quality The quality setting for image compression.
|
158
|
+
# @param [Numeric] width The desired width of the output image.
|
159
|
+
# @param [Numeric] height The desired height of the output image.
|
160
|
+
# @return [Origami::Graphics::ImageXObject] The resulting image XObject.
|
115
161
|
def self.process_image_xobject(image_data, image_quality, width, height)
|
116
162
|
compressed_data = Image::ImageCompressor.compress_image(
|
117
163
|
image_data,
|
data/lib/mindee/pdf.rb
CHANGED
@@ -12,6 +12,8 @@ module Mindee
|
|
12
12
|
class BarcodeReaderV1 < Mindee::Parsing::Common::Inference
|
13
13
|
@endpoint_name = 'barcode_reader'
|
14
14
|
@endpoint_version = '1'
|
15
|
+
@has_async = false
|
16
|
+
@has_sync = true
|
15
17
|
|
16
18
|
# @param prediction [Hash]
|
17
19
|
def initialize(prediction)
|
@@ -19,9 +21,7 @@ module Mindee
|
|
19
21
|
@prediction = BarcodeReaderV1Document.new(prediction['prediction'], nil)
|
20
22
|
@pages = []
|
21
23
|
prediction['pages'].each do |page|
|
22
|
-
|
23
|
-
@pages.push(BarcodeReaderV1Page.new(page))
|
24
|
-
end
|
24
|
+
@pages.push(BarcodeReaderV1Page.new(page))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -32,6 +32,12 @@ module Mindee
|
|
32
32
|
# Version for this product.
|
33
33
|
# @return [String]
|
34
34
|
attr_reader :endpoint_version
|
35
|
+
# Whether this product has access to an asynchronous endpoint.
|
36
|
+
# @return [bool]
|
37
|
+
attr_reader :has_async
|
38
|
+
# Whether this product has access to synchronous endpoint.
|
39
|
+
# @return [bool]
|
40
|
+
attr_reader :has_sync
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
@@ -18,14 +18,14 @@ module Mindee
|
|
18
18
|
# @param prediction [Hash]
|
19
19
|
# @param page_id [Integer, nil]
|
20
20
|
def initialize(prediction, page_id)
|
21
|
-
super
|
22
|
-
@codes_1d = []
|
21
|
+
super
|
22
|
+
@codes_1d = [] # : Array[Parsing::Standard::StringField]
|
23
23
|
prediction['codes_1d'].each do |item|
|
24
|
-
@codes_1d.push(StringField.new(item, page_id))
|
24
|
+
@codes_1d.push(Parsing::Standard::StringField.new(item, page_id))
|
25
25
|
end
|
26
|
-
@codes_2d = []
|
26
|
+
@codes_2d = [] # : Array[Parsing::Standard::StringField]
|
27
27
|
prediction['codes_2d'].each do |item|
|
28
|
-
@codes_2d.push(StringField.new(item, page_id))
|
28
|
+
@codes_2d.push(Parsing::Standard::StringField.new(item, page_id))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -10,11 +10,15 @@ module Mindee
|
|
10
10
|
class BarcodeReaderV1Page < Mindee::Parsing::Common::Page
|
11
11
|
# @param prediction [Hash]
|
12
12
|
def initialize(prediction)
|
13
|
-
super
|
14
|
-
@prediction =
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
super
|
14
|
+
@prediction = if prediction['prediction'].empty?
|
15
|
+
nil
|
16
|
+
else
|
17
|
+
BarcodeReaderV1PagePrediction.new(
|
18
|
+
prediction['prediction'],
|
19
|
+
prediction['id']
|
20
|
+
)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
@@ -12,6 +12,8 @@ module Mindee
|
|
12
12
|
class BillOfLadingV1 < Mindee::Parsing::Common::Inference
|
13
13
|
@endpoint_name = 'bill_of_lading'
|
14
14
|
@endpoint_version = '1'
|
15
|
+
@has_async = true
|
16
|
+
@has_sync = false
|
15
17
|
|
16
18
|
# @param prediction [Hash]
|
17
19
|
def initialize(prediction)
|
@@ -19,9 +21,7 @@ module Mindee
|
|
19
21
|
@prediction = BillOfLadingV1Document.new(prediction['prediction'], nil)
|
20
22
|
@pages = []
|
21
23
|
prediction['pages'].each do |page|
|
22
|
-
|
23
|
-
@pages.push(BillOfLadingV1Page.new(page))
|
24
|
-
end
|
24
|
+
@pages.push(BillOfLadingV1Page.new(page))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -32,6 +32,12 @@ module Mindee
|
|
32
32
|
# Version for this product.
|
33
33
|
# @return [String]
|
34
34
|
attr_reader :endpoint_version
|
35
|
+
# Whether this product has access to an asynchronous endpoint.
|
36
|
+
# @return [bool]
|
37
|
+
attr_reader :has_async
|
38
|
+
# Whether this product has access to synchronous endpoint.
|
39
|
+
# @return [bool]
|
40
|
+
attr_reader :has_sync
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
@@ -21,7 +21,7 @@ module Mindee
|
|
21
21
|
# @param prediction [Hash]
|
22
22
|
# @param page_id [Integer, nil]
|
23
23
|
def initialize(prediction, page_id)
|
24
|
-
super
|
24
|
+
super
|
25
25
|
@name = prediction['name']
|
26
26
|
@professional_number = prediction['professional_number']
|
27
27
|
@scac = prediction['scac']
|
@@ -30,7 +30,7 @@ module Mindee
|
|
30
30
|
# @param prediction [Hash]
|
31
31
|
# @param page_id [Integer, nil]
|
32
32
|
def initialize(prediction, page_id)
|
33
|
-
super
|
33
|
+
super
|
34
34
|
@description = prediction['description']
|
35
35
|
@gross_weight = prediction['gross_weight']
|
36
36
|
@measurement = prediction['measurement']
|
@@ -44,10 +44,13 @@ module Mindee
|
|
44
44
|
def printable_values
|
45
45
|
printable = {}
|
46
46
|
printable[:description] = format_for_display(@description)
|
47
|
-
printable[:gross_weight] =
|
48
|
-
|
47
|
+
printable[:gross_weight] =
|
48
|
+
@gross_weight.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_weight)
|
49
|
+
printable[:measurement] =
|
50
|
+
@measurement.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@measurement)
|
49
51
|
printable[:measurement_unit] = format_for_display(@measurement_unit)
|
50
|
-
printable[:quantity] =
|
52
|
+
printable[:quantity] =
|
53
|
+
@quantity.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@quantity)
|
51
54
|
printable[:weight_unit] = format_for_display(@weight_unit)
|
52
55
|
printable
|
53
56
|
end
|
@@ -56,10 +59,13 @@ module Mindee
|
|
56
59
|
def table_printable_values
|
57
60
|
printable = {}
|
58
61
|
printable[:description] = format_for_display(@description, 36)
|
59
|
-
printable[:gross_weight] =
|
60
|
-
|
62
|
+
printable[:gross_weight] =
|
63
|
+
@gross_weight.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_weight)
|
64
|
+
printable[:measurement] =
|
65
|
+
@measurement.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@measurement)
|
61
66
|
printable[:measurement_unit] = format_for_display(@measurement_unit, nil)
|
62
|
-
printable[:quantity] =
|
67
|
+
printable[:quantity] =
|
68
|
+
@quantity.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@quantity)
|
63
69
|
printable[:weight_unit] = format_for_display(@weight_unit, nil)
|
64
70
|
printable
|
65
71
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'bill_of_lading_v1_shipper'
|
4
|
+
require_relative 'bill_of_lading_v1_consignee'
|
5
|
+
require_relative 'bill_of_lading_v1_notify_party'
|
6
|
+
require_relative 'bill_of_lading_v1_carrier'
|
7
|
+
require_relative 'bill_of_lading_v1_carrier_item'
|
8
|
+
|
9
|
+
module Mindee
|
10
|
+
module Product
|
11
|
+
module BillOfLading
|
12
|
+
# The goods being shipped.
|
13
|
+
class BillOfLadingV1CarrierItems < Array
|
14
|
+
# Entries.
|
15
|
+
# @return [Array<BillOfLadingV1CarrierItem>]
|
16
|
+
attr_reader :entries
|
17
|
+
|
18
|
+
# @param prediction [Array]
|
19
|
+
# @param page_id [Integer, nil]
|
20
|
+
def initialize(prediction, page_id)
|
21
|
+
entries = prediction.map do |entry|
|
22
|
+
BillOfLading::BillOfLadingV1CarrierItem.new(entry, page_id)
|
23
|
+
end
|
24
|
+
super(entries)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Creates a line of rST table-compliant string separators.
|
28
|
+
# @param char [String] Character to use as a separator.
|
29
|
+
# @return [String]
|
30
|
+
def self.line_items_separator(char)
|
31
|
+
out_str = String.new
|
32
|
+
out_str << "+#{char * 38}"
|
33
|
+
out_str << "+#{char * 14}"
|
34
|
+
out_str << "+#{char * 13}"
|
35
|
+
out_str << "+#{char * 18}"
|
36
|
+
out_str << "+#{char * 10}"
|
37
|
+
out_str << "+#{char * 13}"
|
38
|
+
out_str
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def to_s
|
43
|
+
return '' if empty?
|
44
|
+
|
45
|
+
lines = map do |entry|
|
46
|
+
"\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
|
47
|
+
end.join
|
48
|
+
out_str = String.new
|
49
|
+
out_str << ("\n#{self.class.line_items_separator('-')}\n ")
|
50
|
+
out_str << ' | Description '
|
51
|
+
out_str << ' | Gross Weight'
|
52
|
+
out_str << ' | Measurement'
|
53
|
+
out_str << ' | Measurement Unit'
|
54
|
+
out_str << ' | Quantity'
|
55
|
+
out_str << ' | Weight Unit'
|
56
|
+
out_str << (" |\n#{self.class.line_items_separator('=')}")
|
57
|
+
out_str + lines
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|