mindee 4.5.0 → 4.7.0.pre.rc1
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/CHANGELOG.md +17 -0
- data/README.md +21 -222
- data/docs/code_samples/default_v2.txt +28 -0
- data/docs/global_products/financial_document_v1.md +19 -4
- data/docs/global_products/invoices_v4.md +19 -4
- data/lib/mindee/client.rb +11 -30
- data/lib/mindee/client_v2.rb +109 -0
- data/lib/mindee/errors/mindee_http_error_v2.rb +26 -0
- data/lib/mindee/errors.rb +1 -0
- data/lib/mindee/geometry/point.rb +2 -2
- data/lib/mindee/geometry/quadrilateral.rb +4 -4
- data/lib/mindee/geometry/utils.rb +1 -0
- data/lib/mindee/http/api_settings_v2.rb +61 -0
- data/lib/mindee/http/endpoint.rb +12 -6
- data/lib/mindee/http/http_error_handler.rb +17 -4
- data/lib/mindee/http/mindee_api_v2.rb +148 -0
- data/lib/mindee/http/response_validation.rb +20 -1
- data/lib/mindee/http/workflow_endpoint.rb +2 -2
- data/lib/mindee/http.rb +2 -0
- data/lib/mindee/image/extracted_image.rb +1 -1
- data/lib/mindee/image/image_extractor.rb +10 -10
- data/lib/mindee/input/inference_parameters.rb +116 -0
- data/lib/mindee/input/local_response.rb +10 -1
- data/lib/mindee/input/polling_options.rb +26 -0
- data/lib/mindee/input/sources/base64_input_source.rb +2 -2
- data/lib/mindee/input/sources/local_input_source.rb +19 -12
- data/lib/mindee/input.rb +2 -0
- data/lib/mindee/page_options.rb +24 -0
- data/lib/mindee/parsing/common/api_request.rb +2 -2
- data/lib/mindee/parsing/common/api_response.rb +4 -0
- data/lib/mindee/parsing/common/execution.rb +1 -1
- data/lib/mindee/parsing/common/extras/extras.rb +2 -2
- data/lib/mindee/parsing/common/extras/rag_extra.rb +2 -0
- data/lib/mindee/parsing/common/inference.rb +1 -1
- data/lib/mindee/parsing/common/ocr/ocr.rb +4 -6
- data/lib/mindee/parsing/common/orientation.rb +2 -2
- data/lib/mindee/parsing/common/product.rb +6 -1
- data/lib/mindee/parsing/standard/address_field.rb +49 -0
- data/lib/mindee/parsing/standard/amount_field.rb +2 -2
- data/lib/mindee/parsing/standard/feature_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/universal/universal_list_field.rb +2 -2
- data/lib/mindee/parsing/universal/universal_object_field.rb +7 -4
- data/lib/mindee/parsing/v2/common_response.rb +18 -0
- data/lib/mindee/parsing/v2/error_response.rb +36 -0
- data/lib/mindee/parsing/v2/field/base_field.rb +60 -0
- data/lib/mindee/parsing/v2/field/field_confidence.rb +91 -0
- data/lib/mindee/parsing/v2/field/field_location.rb +36 -0
- data/lib/mindee/parsing/v2/field/inference_fields.rb +96 -0
- data/lib/mindee/parsing/v2/field/list_field.rb +88 -0
- data/lib/mindee/parsing/v2/field/object_field.rb +102 -0
- data/lib/mindee/parsing/v2/field/simple_field.rb +56 -0
- data/lib/mindee/parsing/v2/field.rb +9 -0
- data/lib/mindee/parsing/v2/inference.rb +50 -0
- data/lib/mindee/parsing/v2/inference_file.rb +38 -0
- data/lib/mindee/parsing/v2/inference_model.rb +18 -0
- data/lib/mindee/parsing/v2/inference_response.rb +30 -0
- data/lib/mindee/parsing/v2/inference_result.rb +49 -0
- data/lib/mindee/parsing/v2/inference_result_options.rb +21 -0
- data/lib/mindee/parsing/v2/job.rb +86 -0
- data/lib/mindee/parsing/v2/job_response.rb +30 -0
- data/lib/mindee/parsing/v2/job_webhook.rb +60 -0
- data/lib/mindee/parsing/v2/raw_text.rb +21 -0
- data/lib/mindee/parsing/v2.rb +15 -0
- data/lib/mindee/pdf/extracted_pdf.rb +5 -3
- data/lib/mindee/pdf/pdf_extractor.rb +11 -7
- data/lib/mindee/pdf/pdf_processor.rb +6 -6
- data/lib/mindee/pdf/pdf_tools.rb +4 -2
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +8 -8
- data/lib/mindee/product/invoice/invoice_v4_document.rb +8 -8
- data/lib/mindee/product/universal/universal_prediction.rb +4 -4
- data/lib/mindee/version.rb +2 -2
- data/lib/mindee.rb +6 -0
- data/mindee.gemspec +1 -1
- data/sig/custom/mini_magick.rbs +14 -7
- data/sig/custom/net_http.rbs +4 -4
- data/sig/custom/origami.rbs +9 -4
- data/sig/mindee/client.rbs +14 -19
- data/sig/mindee/client_v2.rbs +17 -0
- data/sig/mindee/errors/mindee_http_error.rbs +6 -5
- data/sig/mindee/errors/mindee_http_error_v2.rbs +12 -0
- data/sig/mindee/errors/mindee_input_error.rbs +3 -2
- data/sig/mindee/geometry/min_max.rbs +4 -3
- data/sig/mindee/geometry/point.rbs +5 -6
- data/sig/mindee/geometry/polygon.rbs +3 -3
- data/sig/mindee/geometry/quadrilateral.rbs +5 -8
- data/sig/mindee/geometry/utils.rbs +8 -8
- data/sig/mindee/http/api_settings_v2.rbs +23 -0
- data/sig/mindee/http/endpoint.rbs +12 -11
- data/sig/mindee/http/http_error_handler.rbs +8 -3
- data/sig/mindee/http/mindee_api_v2.rbs +18 -0
- data/sig/mindee/http/response_validation.rbs +1 -0
- data/sig/mindee/http/workflow_endpoint.rbs +1 -1
- data/sig/mindee/image/extracted_image.rbs +2 -2
- data/sig/mindee/image/image_compressor.rbs +1 -1
- data/sig/mindee/image/image_extractor.rbs +5 -5
- data/sig/mindee/image/image_utils.rbs +10 -10
- data/sig/mindee/input/inference_parameters.rbs +30 -0
- data/sig/mindee/input/local_response.rbs +6 -5
- data/sig/mindee/input/polling_options.rbs +12 -0
- data/sig/mindee/input/sources/base64_input_source.rbs +1 -1
- data/sig/mindee/input/sources/local_input_source.rbs +10 -7
- data/sig/mindee/input/sources/url_input_source.rbs +1 -1
- data/sig/mindee/logging/logger.rbs +2 -0
- data/sig/mindee/page_options.rbs +11 -0
- data/sig/mindee/parsing/common/api_request.rbs +6 -6
- data/sig/mindee/parsing/common/api_response.rbs +2 -2
- data/sig/mindee/parsing/common/document.rbs +10 -10
- data/sig/mindee/parsing/common/execution.rbs +15 -14
- data/sig/mindee/parsing/common/execution_file.rbs +3 -3
- data/sig/mindee/parsing/common/extras/cropper_extra.rbs +3 -2
- data/sig/mindee/parsing/common/extras/extras.rbs +6 -5
- data/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs +2 -1
- data/sig/mindee/parsing/common/inference.rbs +16 -9
- data/sig/mindee/parsing/common/job.rbs +2 -2
- data/sig/mindee/parsing/common/ocr/mvision_v1.rbs +2 -2
- data/sig/mindee/parsing/common/ocr/ocr.rbs +22 -20
- data/sig/mindee/parsing/common/orientation.rbs +4 -3
- data/sig/mindee/parsing/common/page.rbs +6 -5
- data/sig/mindee/parsing/common/product.rbs +4 -4
- data/sig/mindee/parsing/common/workflow_response.rbs +8 -4
- data/sig/mindee/parsing/standard/abstract_field.rbs +1 -1
- data/sig/mindee/parsing/standard/address_field.rbs +18 -0
- data/sig/mindee/parsing/standard/amount_field.rbs +6 -4
- data/sig/mindee/parsing/standard/base_field.rbs +1 -1
- data/sig/mindee/parsing/standard/boolean_field.rbs +1 -1
- data/sig/mindee/parsing/standard/company_registration_field.rbs +3 -2
- data/sig/mindee/parsing/standard/date_field.rbs +6 -6
- data/sig/mindee/parsing/standard/locale_field.rbs +1 -1
- data/sig/mindee/parsing/standard/payment_details_field.rbs +7 -6
- data/sig/mindee/parsing/standard/position_field.rbs +2 -2
- data/sig/mindee/parsing/standard/string_field.rbs +1 -1
- data/sig/mindee/parsing/standard/tax_field.rbs +8 -7
- data/sig/mindee/parsing/universal/universal_list_field.rbs +4 -5
- data/sig/mindee/parsing/universal/universal_object_field.rbs +17 -11
- data/sig/mindee/parsing/v2/common_response.rbs +11 -0
- data/sig/mindee/parsing/v2/error_response.rbs +16 -0
- data/sig/mindee/parsing/v2/field/base_field.rbs +17 -0
- data/sig/mindee/parsing/v2/field/field_confidence.rbs +27 -0
- data/sig/mindee/parsing/v2/field/field_location.rbs +16 -0
- data/sig/mindee/parsing/v2/field/inference_fields.rbs +19 -0
- data/sig/mindee/parsing/v2/field/list_field.rbs +22 -0
- data/sig/mindee/parsing/v2/field/object_field.rbs +21 -0
- data/sig/mindee/parsing/v2/field/simple_field.rbs +16 -0
- data/sig/mindee/parsing/v2/inference.rbs +16 -0
- data/sig/mindee/parsing/v2/inference_file.rbs +15 -0
- data/sig/mindee/parsing/v2/inference_model.rbs +11 -0
- data/sig/mindee/parsing/v2/inference_response.rbs +12 -0
- data/sig/mindee/parsing/v2/inference_result.rbs +13 -0
- data/sig/mindee/parsing/v2/inference_result_options.rbs +11 -0
- data/sig/mindee/parsing/v2/job.rbs +22 -0
- data/sig/mindee/parsing/v2/job_response.rbs +12 -0
- data/sig/mindee/parsing/v2/job_webhook.rbs +17 -0
- data/sig/mindee/parsing/v2/raw_text.rbs +12 -0
- data/sig/mindee/pdf/extracted_pdf.rbs +6 -6
- data/sig/mindee/pdf/pdf_compressor.rbs +4 -4
- data/sig/mindee/pdf/pdf_extractor.rbs +8 -7
- data/sig/mindee/pdf/pdf_processor.rbs +4 -4
- data/sig/mindee/pdf/pdf_tools.rbs +22 -16
- data/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs +1 -1
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs +1 -1
- data/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs +2 -2
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs +1 -1
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs +2 -2
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs +3 -3
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs +2 -2
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs +1 -1
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs +2 -2
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs +2 -2
- data/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs +2 -2
- data/sig/mindee/product/business_card/business_card_v1.rbs +1 -1
- data/sig/mindee/product/business_card/business_card_v1_document.rbs +1 -1
- data/sig/mindee/product/business_card/business_card_v1_page.rbs +2 -2
- data/sig/mindee/product/cropper/cropper_v1.rbs +1 -1
- data/sig/mindee/product/cropper/cropper_v1_document.rbs +1 -1
- data/sig/mindee/product/cropper/cropper_v1_page.rbs +2 -2
- data/sig/mindee/product/delivery_note/delivery_note_v1.rbs +1 -1
- data/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs +1 -1
- data/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs +2 -2
- data/sig/mindee/product/driver_license/driver_license_v1.rbs +1 -1
- data/sig/mindee/product/driver_license/driver_license_v1_document.rbs +1 -1
- data/sig/mindee/product/driver_license/driver_license_v1_page.rbs +2 -2
- data/sig/mindee/product/financial_document/financial_document_v1.rbs +1 -1
- data/sig/mindee/product/financial_document/financial_document_v1_document.rbs +5 -5
- data/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs +3 -3
- data/sig/mindee/product/financial_document/financial_document_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs +1 -1
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs +1 -1
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs +1 -1
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs +2 -2
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs +1 -1
- data/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs +2 -2
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs +1 -1
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs +1 -1
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs +2 -2
- data/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs +3 -3
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs +1 -1
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs +1 -1
- data/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs +1 -1
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs +1 -1
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs +2 -2
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs +2 -2
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs +3 -3
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs +2 -2
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs +3 -3
- data/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs +3 -3
- data/sig/mindee/product/fr/health_card/health_card_v1.rbs +1 -1
- data/sig/mindee/product/fr/health_card/health_card_v1_document.rbs +1 -1
- data/sig/mindee/product/fr/health_card/health_card_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/id_card/id_card_v1.rbs +1 -1
- data/sig/mindee/product/fr/id_card/id_card_v1_document.rbs +1 -1
- data/sig/mindee/product/fr/id_card/id_card_v1_page.rbs +2 -2
- data/sig/mindee/product/fr/id_card/id_card_v2.rbs +1 -1
- data/sig/mindee/product/fr/id_card/id_card_v2_document.rbs +1 -1
- data/sig/mindee/product/fr/id_card/id_card_v2_page.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2.rbs +1 -1
- data/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_document.rbs +1 -1
- data/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_page.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs +3 -3
- data/sig/mindee/product/fr/payslip/payslip_v3.rbs +1 -1
- data/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_document.rbs +1 -1
- data/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_page.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs +3 -3
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs +2 -2
- data/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs +3 -3
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs +1 -1
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs +1 -1
- data/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs +2 -2
- data/sig/mindee/product/international_id/international_id_v2.rbs +1 -1
- data/sig/mindee/product/international_id/international_id_v2_document.rbs +1 -1
- data/sig/mindee/product/international_id/international_id_v2_page.rbs +2 -2
- data/sig/mindee/product/invoice/invoice_v4.rbs +1 -1
- data/sig/mindee/product/invoice/invoice_v4_document.rbs +5 -5
- data/sig/mindee/product/invoice/invoice_v4_line_item.rbs +3 -3
- data/sig/mindee/product/invoice/invoice_v4_page.rbs +2 -2
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs +1 -1
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs +1 -1
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs +3 -3
- data/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs +2 -2
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs +1 -1
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs +1 -1
- data/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs +1 -1
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs +1 -1
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs +3 -3
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs +2 -2
- data/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs +2 -2
- data/sig/mindee/product/passport/passport_v1.rbs +1 -1
- data/sig/mindee/product/passport/passport_v1_document.rbs +1 -1
- data/sig/mindee/product/passport/passport_v1_page.rbs +2 -2
- data/sig/mindee/product/receipt/receipt_v5.rbs +1 -1
- data/sig/mindee/product/receipt/receipt_v5_document.rbs +1 -1
- data/sig/mindee/product/receipt/receipt_v5_line_item.rbs +3 -3
- data/sig/mindee/product/receipt/receipt_v5_page.rbs +2 -2
- data/sig/mindee/product/resume/resume_v1.rbs +1 -1
- data/sig/mindee/product/resume/resume_v1_certificate.rbs +3 -3
- data/sig/mindee/product/resume/resume_v1_document.rbs +1 -1
- data/sig/mindee/product/resume/resume_v1_education.rbs +3 -3
- data/sig/mindee/product/resume/resume_v1_language.rbs +3 -3
- data/sig/mindee/product/resume/resume_v1_page.rbs +2 -2
- data/sig/mindee/product/resume/resume_v1_professional_experience.rbs +3 -3
- data/sig/mindee/product/resume/resume_v1_social_networks_url.rbs +3 -3
- data/sig/mindee/product/universal/universal.rbs +5 -5
- data/sig/mindee/product/universal/universal_document.rbs +1 -1
- data/sig/mindee/product/universal/universal_page.rbs +2 -2
- data/sig/mindee/product/universal/universal_prediction.rbs +5 -5
- data/sig/mindee/product/us/bank_check/bank_check_v1.rbs +1 -1
- data/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs +1 -1
- data/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs +2 -2
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs +1 -1
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs +3 -3
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs +1 -1
- data/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs +2 -2
- data/sig/mindee/product/us/us_mail/us_mail_v2.rbs +1 -1
- data/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs +1 -1
- data/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs +2 -2
- data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs +3 -3
- data/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs +2 -2
- data/sig/mindee/product/us/us_mail/us_mail_v3.rbs +1 -1
- data/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs +1 -1
- data/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs +2 -2
- data/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs +3 -3
- data/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs +2 -2
- data/sig/mindee/product/us/w9/w9_v1.rbs +1 -1
- data/sig/mindee/product/us/w9/w9_v1_document.rbs +1 -1
- data/sig/mindee/product/us/w9/w9_v1_page.rbs +2 -2
- data/sig/mindee/version.rbs +2 -2
- metadata +63 -6
@@ -0,0 +1,60 @@
|
|
1
|
+
# lib/mindee/parsing/v2/job_response_webhook.rb
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
require_relative 'error_response'
|
6
|
+
|
7
|
+
module Mindee
|
8
|
+
module Parsing
|
9
|
+
module V2
|
10
|
+
# Information about a webhook created for a job response.
|
11
|
+
class JobWebhook
|
12
|
+
# @return [String] Identifier of the webhook.
|
13
|
+
attr_reader :id
|
14
|
+
# @return [DateTime, nil] Creation timestamp (or +nil+ when absent).
|
15
|
+
attr_reader :created_at
|
16
|
+
# @return [String] Webhook status.
|
17
|
+
attr_reader :status
|
18
|
+
# @return [ErrorResponse, nil] Error information when something failed.
|
19
|
+
attr_reader :error
|
20
|
+
|
21
|
+
# @param server_response [Hash] Raw JSON parsed into a Hash.
|
22
|
+
def initialize(server_response)
|
23
|
+
@id = server_response['id']
|
24
|
+
@created_at = parse_date(server_response['created_at'])
|
25
|
+
@status = server_response['status']
|
26
|
+
@error = ErrorResponse.new(server_response['error']) if server_response.key?('error')
|
27
|
+
end
|
28
|
+
|
29
|
+
# RST display.
|
30
|
+
#
|
31
|
+
# @return [String]
|
32
|
+
def to_s
|
33
|
+
parts = [
|
34
|
+
'JobResponseWebhook',
|
35
|
+
'##################',
|
36
|
+
":ID: #{@id}",
|
37
|
+
":CreatedAt: #{@created_at}",
|
38
|
+
":Status: #{@status}",
|
39
|
+
]
|
40
|
+
|
41
|
+
parts << @error.to_s if @error
|
42
|
+
parts.join("\n")
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
# Safely parse an ISO-8601 date/time string to DateTime.
|
48
|
+
# @param str [String, nil] The date string.
|
49
|
+
# @return [DateTime, nil]
|
50
|
+
def parse_date(str)
|
51
|
+
return nil if str.to_s.empty?
|
52
|
+
|
53
|
+
DateTime.iso8601(str || '')
|
54
|
+
rescue ArgumentError
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mindee
|
4
|
+
module Parsing
|
5
|
+
module V2
|
6
|
+
# Raw text extracted from a given page.
|
7
|
+
class RawText
|
8
|
+
# @return [Integer] Page number where the text was found.
|
9
|
+
attr_reader :page
|
10
|
+
# @return [String] Text content.
|
11
|
+
attr_reader :content
|
12
|
+
|
13
|
+
# @param server_response [Hash] Raw JSON parsed into a Hash.
|
14
|
+
def initialize(server_response)
|
15
|
+
@page = server_response['page']
|
16
|
+
@content = server_response['content']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'v2/common_response'
|
4
|
+
require_relative 'v2/error_response'
|
5
|
+
require_relative 'v2/field'
|
6
|
+
require_relative 'v2/inference'
|
7
|
+
require_relative 'v2/inference_file'
|
8
|
+
require_relative 'v2/inference_model'
|
9
|
+
require_relative 'v2/inference_response'
|
10
|
+
require_relative 'v2/inference_result'
|
11
|
+
require_relative 'v2/inference_result_options'
|
12
|
+
require_relative 'v2/job'
|
13
|
+
require_relative 'v2/job_response'
|
14
|
+
require_relative 'v2/job_webhook'
|
15
|
+
require_relative 'v2/raw_text'
|
@@ -7,14 +7,14 @@ module Mindee
|
|
7
7
|
# An extracted sub-Pdf.
|
8
8
|
class ExtractedPDF
|
9
9
|
# Byte contents of the pdf
|
10
|
-
# @return [
|
10
|
+
# @return [StringIO]
|
11
11
|
attr_reader :pdf_bytes
|
12
12
|
|
13
13
|
# Name of the file.
|
14
14
|
# @return [String]
|
15
15
|
attr_reader :filename
|
16
16
|
|
17
|
-
# @param pdf_bytes [
|
17
|
+
# @param pdf_bytes [StringIO]
|
18
18
|
# @param filename [String]
|
19
19
|
def initialize(pdf_bytes, filename)
|
20
20
|
@pdf_bytes = pdf_bytes
|
@@ -50,7 +50,9 @@ module Mindee
|
|
50
50
|
# Returns the current PDF object as a usable BytesInputSource.
|
51
51
|
# @return [Mindee::Input::Source::BytesInputSource]
|
52
52
|
def as_input_source
|
53
|
-
|
53
|
+
raise Errors::MindeePDFError, 'Bytes object is nil.' if @pdf_bytes.nil?
|
54
|
+
|
55
|
+
Mindee::Input::Source::BytesInputSource.new(@pdf_bytes.read || '', @filename)
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
@@ -29,7 +29,7 @@ module Mindee
|
|
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
|
-
# @return [
|
32
|
+
# @return [StringIO] The buffer containing the new Pdf.
|
33
33
|
def cut_pages(page_indexes)
|
34
34
|
options = PageOptions.new(params: {
|
35
35
|
page_indexes: page_indexes,
|
@@ -75,24 +75,28 @@ module Mindee
|
|
75
75
|
# @return [Array<Mindee::PDF::PDFExtractor::ExtractedPDF>]
|
76
76
|
def extract_invoices(page_indexes, strict: false)
|
77
77
|
raise Errors::MindeePDFError, 'No indexes provided.' if page_indexes.empty?
|
78
|
+
|
78
79
|
if page_indexes[0].is_a?(Array) && page_indexes[0].all? { |i| i.is_a?(Integer) }
|
79
|
-
|
80
|
+
page_indexes_as_array = page_indexes # @type var page_indexes : Array[Array[Integer]]
|
81
|
+
return extract_sub_documents(page_indexes_as_array)
|
80
82
|
end
|
81
|
-
|
83
|
+
p_ids = page_indexes # @type var page_indexes: Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroups
|
84
|
+
return extract_sub_documents(p_ids.map(&:page_indexes)) unless strict
|
82
85
|
|
83
86
|
correct_page_indexes = []
|
84
87
|
current_list = []
|
85
88
|
previous_confidence = nil
|
86
|
-
|
87
|
-
|
89
|
+
p_ids.each_with_index do |p_i, i|
|
90
|
+
page_index = p_i # @type var page_index: Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroup
|
91
|
+
confidence = page_index.confidence.to_f
|
88
92
|
page_list = page_index.page_indexes
|
89
93
|
|
90
94
|
if confidence >= 0.5 && previous_confidence.nil?
|
91
95
|
current_list = page_list
|
92
|
-
elsif confidence >= 0.5 && i <
|
96
|
+
elsif confidence >= 0.5 && i < p_ids.length - 1
|
93
97
|
correct_page_indexes << current_list
|
94
98
|
current_list = page_list
|
95
|
-
elsif confidence < 0.5 && i ==
|
99
|
+
elsif confidence < 0.5 && i == p_ids.length - 1
|
96
100
|
current_list.concat page_list
|
97
101
|
correct_page_indexes << current_list
|
98
102
|
else
|
@@ -17,7 +17,7 @@ module Mindee
|
|
17
17
|
pages_count = current_pdf.pages.size
|
18
18
|
return current_pdf.to_io_stream if options.on_min_pages.to_i > pages_count
|
19
19
|
|
20
|
-
all_pages = (0..pages_count - 1).to_a
|
20
|
+
all_pages = (0..(pages_count - 1)).to_a
|
21
21
|
|
22
22
|
if options.operation == :KEEP_ONLY
|
23
23
|
pages_to_remove = indexes_from_keep(options.page_indexes, all_pages)
|
@@ -31,8 +31,8 @@ module Mindee
|
|
31
31
|
current_pdf.to_io_stream
|
32
32
|
end
|
33
33
|
|
34
|
-
# @param page_indexes [Array]
|
35
|
-
# @param all_pages [Array]
|
34
|
+
# @param page_indexes [Array<Integer>]
|
35
|
+
# @param all_pages [Array<Integer>]
|
36
36
|
def self.indexes_from_keep(page_indexes, all_pages)
|
37
37
|
pages_to_keep = Set.new
|
38
38
|
page_indexes.each do |idx|
|
@@ -42,11 +42,11 @@ module Mindee
|
|
42
42
|
|
43
43
|
pages_to_keep << page
|
44
44
|
end
|
45
|
-
all_pages.to_set - pages_to_keep
|
45
|
+
(all_pages.to_set - pages_to_keep).to_a
|
46
46
|
end
|
47
47
|
|
48
|
-
# @param page_indexes [Array
|
49
|
-
# @param all_pages [Array]
|
48
|
+
# @param page_indexes [Array<Integer>]
|
49
|
+
# @param all_pages [Array<Integer>]
|
50
50
|
def self.indexes_from_remove(page_indexes, all_pages)
|
51
51
|
pages_to_remove = Set.new
|
52
52
|
page_indexes.each do |idx|
|
data/lib/mindee/pdf/pdf_tools.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'origami'
|
4
|
+
|
3
5
|
module Mindee
|
4
6
|
module PDF
|
5
7
|
# Collection of miscellaneous PDF operations,as well as some monkey-patching for Origami.
|
@@ -84,7 +86,7 @@ module Mindee
|
|
84
86
|
# Converts the given image to a binary stream using Mindee's image utilities, then creates
|
85
87
|
# an Origami::Graphics::ImageXObject with a JPEG filter.
|
86
88
|
#
|
87
|
-
# @param [
|
89
|
+
# @param [MiniMagick::Image] image An image object with the necessary data and structure.
|
88
90
|
# @return [Origami::Graphics::ImageXObject] The created image XObject.
|
89
91
|
def self.create_xobject(image)
|
90
92
|
image_io = Mindee::Image::ImageUtils.image_to_stringio(image)
|
@@ -153,7 +155,7 @@ module Mindee
|
|
153
155
|
|
154
156
|
# Processes an image into an image XObject for PDF embedding.
|
155
157
|
#
|
156
|
-
# @param [
|
158
|
+
# @param [MiniMagick::Image, StringIO] image_data The raw image data.
|
157
159
|
# @param [Integer] image_quality The quality setting for image compression.
|
158
160
|
# @param [Numeric] width The desired width of the output image.
|
159
161
|
# @param [Numeric] height The desired height of the output image.
|
@@ -10,13 +10,13 @@ module Mindee
|
|
10
10
|
class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
|
11
11
|
include Mindee::Parsing::Standard
|
12
12
|
# The customer's address used for billing.
|
13
|
-
# @return [Mindee::Parsing::Standard::
|
13
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
14
14
|
attr_reader :billing_address
|
15
15
|
# The purchase category.
|
16
16
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
17
17
|
attr_reader :category
|
18
18
|
# The address of the customer.
|
19
|
-
# @return [Mindee::Parsing::Standard::
|
19
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
20
20
|
attr_reader :customer_address
|
21
21
|
# List of company registration numbers associated to the customer.
|
22
22
|
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
@@ -65,13 +65,13 @@ module Mindee
|
|
65
65
|
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
66
66
|
attr_reader :reference_numbers
|
67
67
|
# The customer's address used for shipping.
|
68
|
-
# @return [Mindee::Parsing::Standard::
|
68
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
69
69
|
attr_reader :shipping_address
|
70
70
|
# The purchase subcategory for transport, food and shooping.
|
71
71
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
72
72
|
attr_reader :subcategory
|
73
73
|
# The address of the supplier or merchant.
|
74
|
-
# @return [Mindee::Parsing::Standard::
|
74
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
75
75
|
attr_reader :supplier_address
|
76
76
|
# List of company registration numbers associated to the supplier.
|
77
77
|
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
@@ -114,7 +114,7 @@ module Mindee
|
|
114
114
|
# @param page_id [Integer, nil]
|
115
115
|
def initialize(prediction, page_id)
|
116
116
|
super
|
117
|
-
@billing_address = Parsing::Standard::
|
117
|
+
@billing_address = Parsing::Standard::AddressField.new(
|
118
118
|
prediction['billing_address'],
|
119
119
|
page_id
|
120
120
|
)
|
@@ -122,7 +122,7 @@ module Mindee
|
|
122
122
|
prediction['category'],
|
123
123
|
page_id
|
124
124
|
)
|
125
|
-
@customer_address = Parsing::Standard::
|
125
|
+
@customer_address = Parsing::Standard::AddressField.new(
|
126
126
|
prediction['customer_address'],
|
127
127
|
page_id
|
128
128
|
)
|
@@ -182,7 +182,7 @@ module Mindee
|
|
182
182
|
prediction['reference_numbers'].each do |item|
|
183
183
|
@reference_numbers.push(Parsing::Standard::StringField.new(item, page_id))
|
184
184
|
end
|
185
|
-
@shipping_address = Parsing::Standard::
|
185
|
+
@shipping_address = Parsing::Standard::AddressField.new(
|
186
186
|
prediction['shipping_address'],
|
187
187
|
page_id
|
188
188
|
)
|
@@ -190,7 +190,7 @@ module Mindee
|
|
190
190
|
prediction['subcategory'],
|
191
191
|
page_id
|
192
192
|
)
|
193
|
-
@supplier_address = Parsing::Standard::
|
193
|
+
@supplier_address = Parsing::Standard::AddressField.new(
|
194
194
|
prediction['supplier_address'],
|
195
195
|
page_id
|
196
196
|
)
|
@@ -10,13 +10,13 @@ module Mindee
|
|
10
10
|
class InvoiceV4Document < Mindee::Parsing::Common::Prediction
|
11
11
|
include Mindee::Parsing::Standard
|
12
12
|
# The customer billing address.
|
13
|
-
# @return [Mindee::Parsing::Standard::
|
13
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
14
14
|
attr_reader :billing_address
|
15
15
|
# The purchase category.
|
16
16
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
17
17
|
attr_reader :category
|
18
18
|
# The address of the customer.
|
19
|
-
# @return [Mindee::Parsing::Standard::
|
19
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
20
20
|
attr_reader :customer_address
|
21
21
|
# List of company registration numbers associated to the customer.
|
22
22
|
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
@@ -58,13 +58,13 @@ module Mindee
|
|
58
58
|
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
59
59
|
attr_reader :reference_numbers
|
60
60
|
# Customer's delivery address.
|
61
|
-
# @return [Mindee::Parsing::Standard::
|
61
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
62
62
|
attr_reader :shipping_address
|
63
63
|
# The purchase subcategory for transport, food and shopping.
|
64
64
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
65
65
|
attr_reader :subcategory
|
66
66
|
# The address of the supplier or merchant.
|
67
|
-
# @return [Mindee::Parsing::Standard::
|
67
|
+
# @return [Mindee::Parsing::Standard::AddressField]
|
68
68
|
attr_reader :supplier_address
|
69
69
|
# List of company registration numbers associated to the supplier.
|
70
70
|
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
@@ -101,7 +101,7 @@ module Mindee
|
|
101
101
|
# @param page_id [Integer, nil]
|
102
102
|
def initialize(prediction, page_id)
|
103
103
|
super
|
104
|
-
@billing_address = Parsing::Standard::
|
104
|
+
@billing_address = Parsing::Standard::AddressField.new(
|
105
105
|
prediction['billing_address'],
|
106
106
|
page_id
|
107
107
|
)
|
@@ -109,7 +109,7 @@ module Mindee
|
|
109
109
|
prediction['category'],
|
110
110
|
page_id
|
111
111
|
)
|
112
|
-
@customer_address = Parsing::Standard::
|
112
|
+
@customer_address = Parsing::Standard::AddressField.new(
|
113
113
|
prediction['customer_address'],
|
114
114
|
page_id
|
115
115
|
)
|
@@ -159,7 +159,7 @@ module Mindee
|
|
159
159
|
prediction['reference_numbers'].each do |item|
|
160
160
|
@reference_numbers.push(Parsing::Standard::StringField.new(item, page_id))
|
161
161
|
end
|
162
|
-
@shipping_address = Parsing::Standard::
|
162
|
+
@shipping_address = Parsing::Standard::AddressField.new(
|
163
163
|
prediction['shipping_address'],
|
164
164
|
page_id
|
165
165
|
)
|
@@ -167,7 +167,7 @@ module Mindee
|
|
167
167
|
prediction['subcategory'],
|
168
168
|
page_id
|
169
169
|
)
|
170
|
-
@supplier_address = Parsing::Standard::
|
170
|
+
@supplier_address = Parsing::Standard::AddressField.new(
|
171
171
|
prediction['supplier_address'],
|
172
172
|
page_id
|
173
173
|
)
|
@@ -16,7 +16,7 @@ module Mindee
|
|
16
16
|
|
17
17
|
def initialize(_ = nil)
|
18
18
|
super
|
19
|
-
@fields = {} # : Hash[
|
19
|
+
@fields = {} # : Hash[String | Symbol, untyped]
|
20
20
|
end
|
21
21
|
|
22
22
|
# String representation.
|
@@ -81,7 +81,7 @@ module Mindee
|
|
81
81
|
# Returns a hash of all fields that aren't a collection
|
82
82
|
# @return [Hash<String, StringField>]
|
83
83
|
def single_fields
|
84
|
-
single_fields = {} # : Hash[
|
84
|
+
single_fields = {} # : Hash[String | Symbol, untyped]
|
85
85
|
@fields.each do |field_name, field_value|
|
86
86
|
single_fields[field_name] = field_value if field_value.is_a?(Mindee::Parsing::Standard::StringField)
|
87
87
|
end
|
@@ -91,7 +91,7 @@ module Mindee
|
|
91
91
|
# Returns a hash of all list-like fields
|
92
92
|
# @return [Hash<String, UniversalListField>]
|
93
93
|
def list_fields
|
94
|
-
list_fields = {} # : Hash[
|
94
|
+
list_fields = {} # : Hash[String | Symbol, Mindee::Parsing::Universal::UniversalListField]
|
95
95
|
@fields.each do |field_name, field_value|
|
96
96
|
list_fields[field_name] = field_value if field_value.is_a?(Mindee::Parsing::Universal::UniversalListField)
|
97
97
|
end
|
@@ -101,7 +101,7 @@ module Mindee
|
|
101
101
|
# Returns a hash of all object-like fields
|
102
102
|
# @return [Hash<String, UniversalObjectField>]
|
103
103
|
def object_fields
|
104
|
-
object_fields = {} # : Hash[
|
104
|
+
object_fields = {} # : Hash[String | Symbol, untyped]
|
105
105
|
@fields.each do |field_name, field_value|
|
106
106
|
if field_value.is_a?(Mindee::Parsing::Universal::UniversalObjectField)
|
107
107
|
object_fields[field_name] =
|
data/lib/mindee/version.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Mindee
|
4
4
|
module Mindee
|
5
5
|
# Current version.
|
6
|
-
VERSION = '4.
|
6
|
+
VERSION = '4.7.0-rc1'
|
7
7
|
|
8
8
|
# Finds and return the current platform.
|
9
|
-
# @return [Symbol, Hash[
|
9
|
+
# @return [Symbol, Hash[String | Symbol, Regexp], Nil?]
|
10
10
|
def self.find_platform
|
11
11
|
host = RbConfig::CONFIG['host_os']
|
12
12
|
platforms = {
|
data/lib/mindee.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'mindee/client'
|
4
|
+
require 'mindee/client_v2'
|
5
|
+
require 'mindee/page_options'
|
4
6
|
require 'mindee/logging'
|
5
7
|
|
6
8
|
module Mindee
|
@@ -54,6 +56,10 @@ module Mindee
|
|
54
56
|
# Universal fields and functions.
|
55
57
|
module Universal
|
56
58
|
end
|
59
|
+
|
60
|
+
# V2-specific module.
|
61
|
+
module V2
|
62
|
+
end
|
57
63
|
end
|
58
64
|
|
59
65
|
# Document input-related internals.
|
data/mindee.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rake', '~> 13.2'
|
38
38
|
spec.add_development_dependency 'rbs', '~> 3.6'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.13'
|
40
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
40
|
+
spec.add_development_dependency 'rubocop', '~> 1.76.0'
|
41
41
|
spec.add_development_dependency 'steep', '~> 1.7'
|
42
42
|
spec.add_development_dependency 'yard', '~> 0.9'
|
43
43
|
end
|
data/sig/custom/mini_magick.rbs
CHANGED
@@ -1,24 +1,31 @@
|
|
1
1
|
# Stub for the mini_magick library.
|
2
|
+
# Note: though typing annotations for the MiniMagick library now exist, it seems that they aren't strict enough
|
3
|
+
# to match the rules we have on the repo, hence the existence of this file and the overrides present below.
|
2
4
|
module MiniMagick
|
3
5
|
class Image
|
4
|
-
def format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO
|
5
6
|
def self.format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO
|
7
|
+
def format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO
|
6
8
|
def self.quality: (String) -> Net::BufferedIO
|
7
9
|
def self.crop: (String) -> Net::BufferedIO
|
10
|
+
def crop: (String) -> Net::BufferedIO
|
8
11
|
def self.height: () -> Integer
|
9
|
-
def height: () -> Integer
|
10
12
|
def self.width: () -> Integer
|
13
|
+
def height: () -> Integer
|
11
14
|
def width: () -> Integer
|
12
|
-
def self.
|
15
|
+
def self.data: (?untyped?, ?untyped?) -> untyped
|
16
|
+
def data: (?untyped?, ?untyped) -> instance
|
17
|
+
def self.read: (?untyped?, ?untyped?) -> Image
|
18
|
+
def read: (?untyped?, ?untyped) -> Image
|
13
19
|
def self.resolution: () -> Array[Float | Integer]
|
20
|
+
def resolution: () -> Array[Float | Integer]
|
14
21
|
def self.write: (StringIO | String) -> Net::BufferedIO
|
15
22
|
def write: (StringIO | String) -> Net::BufferedIO
|
16
|
-
def quality: (
|
23
|
+
def quality: (String) -> void
|
17
24
|
def self.resize: (String) -> void
|
18
25
|
def resize: (String) -> void
|
19
26
|
def self.to_blob: () -> String
|
20
27
|
def to_blob: () -> String
|
21
|
-
def self.[]: (
|
22
|
-
def []: (
|
28
|
+
def self.[]: (*untyped) -> untyped
|
29
|
+
def []: (*untyped) -> untyped
|
23
30
|
end
|
24
|
-
end
|
31
|
+
end
|
data/sig/custom/net_http.rbs
CHANGED
@@ -12,7 +12,7 @@ module Net
|
|
12
12
|
|
13
13
|
# Stub for the HTTP POST request class.
|
14
14
|
class Post
|
15
|
-
def initialize: (untyped, Hash[String, String]?) -> void
|
15
|
+
def initialize: (untyped, Hash[String, String?]?) -> void
|
16
16
|
def set_form: (untyped, String?) -> void
|
17
17
|
def new: (untyped, untyped) -> void
|
18
18
|
def []=: (?untyped, ?untyped) -> bool
|
@@ -20,7 +20,7 @@ module Net
|
|
20
20
|
|
21
21
|
# Stub for the HTTP GET request class.
|
22
22
|
class Get
|
23
|
-
def initialize: (untyped, ?Hash[String, String]?) -> void
|
23
|
+
def initialize: (untyped, ?Hash[String, String?]?) -> void
|
24
24
|
def new: (untyped, untyped) -> void
|
25
25
|
def basic_auth: (untyped, untyped) -> void
|
26
26
|
def []=: (?untyped, ?untyped) -> bool
|
@@ -28,8 +28,8 @@ module Net
|
|
28
28
|
end
|
29
29
|
|
30
30
|
class HTTPResponse
|
31
|
-
def self.body: ->
|
32
|
-
def body: ->
|
31
|
+
def self.body: -> String
|
32
|
+
def body: -> String
|
33
33
|
def []: (untyped) -> untyped
|
34
34
|
def key?: (untyped) -> bool
|
35
35
|
def code: -> String
|
data/sig/custom/origami.rbs
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
# Stubs for the origami library.
|
2
2
|
# This one _should_ exist, but it would take too long, so this is a stub.
|
3
3
|
module Origami
|
4
|
+
def compile: (Hash[Symbol, untyped]) -> void
|
4
5
|
class Array
|
5
6
|
def each: { (untyped) -> untyped } -> untyped
|
6
7
|
end
|
7
8
|
class PDF
|
8
|
-
def self.read: (StringIO) -> untyped
|
9
|
+
def self.read: (StringIO | File) -> untyped
|
9
10
|
def initialize: () -> void
|
10
11
|
def append_page: (Page) -> void
|
11
12
|
def delete_pages_at: (::Array[Integer]) -> void
|
12
|
-
def pages: () ->
|
13
|
-
def save: (StringIO) -> void
|
13
|
+
def pages: () -> ::Array[Page]
|
14
|
+
def save: (StringIO | File) -> void
|
14
15
|
def to_io_stream: -> StringIO
|
15
16
|
class LinearParser
|
16
17
|
def initialize: (Hash[Symbol, untyped]) -> void
|
17
18
|
def new: (Hash[Symbol, untyped]) -> void
|
18
|
-
def parse: (StringIO?) -> PDF
|
19
|
+
def parse: (StringIO | File?) -> PDF
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -23,6 +24,9 @@ module Origami
|
|
23
24
|
def initialize: () -> void
|
24
25
|
def add_xobject: (Graphics::ImageXObject, String) -> untyped
|
25
26
|
def Contents: (?untyped?) -> untyped
|
27
|
+
def Contents=: (?untyped?, untyped?) -> untyped
|
28
|
+
def []: (untyped) -> untyped
|
29
|
+
def []=: (untyped, untyped) -> bool
|
26
30
|
end
|
27
31
|
|
28
32
|
module Graphics
|
@@ -31,6 +35,7 @@ module Origami
|
|
31
35
|
|
32
36
|
def BitsPerComponent=: (Integer) -> untyped
|
33
37
|
def ColorSpace=: (Symbol) -> untyped
|
38
|
+
def dictionary: () -> Hash[Symbol, untyped]
|
34
39
|
def data=: (StringIO) -> untyped
|
35
40
|
def self.from_image_file: (StringIO, String) -> untyped
|
36
41
|
def Height=: (Integer | Float) -> untyped
|
data/sig/mindee/client.rbs
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
|
1
|
+
# lib/mindee/client.rb
|
2
2
|
|
3
3
|
module Mindee
|
4
4
|
OTS_OWNER: String
|
5
5
|
|
6
|
-
class PageOptions
|
7
|
-
attr_accessor page_indexes: Array[Integer]
|
8
|
-
attr_accessor operation: :KEEP_ONLY | :REMOVE
|
9
|
-
attr_accessor on_min_pages: Integer?
|
10
|
-
|
11
|
-
def initialize: (params: Hash[Symbol | String, untyped]) -> void
|
12
|
-
end
|
13
|
-
|
14
6
|
class ParseOptions
|
15
7
|
attr_accessor all_words: bool
|
16
8
|
attr_accessor full_text: bool
|
@@ -18,12 +10,12 @@ module Mindee
|
|
18
10
|
attr_accessor page_options: PageOptions
|
19
11
|
attr_accessor cropper: bool
|
20
12
|
attr_accessor rag: bool
|
21
|
-
attr_accessor workflow_id: String
|
13
|
+
attr_accessor workflow_id: String?
|
22
14
|
attr_accessor initial_delay_sec: Integer | Float
|
23
15
|
attr_accessor delay_sec: Integer | Float
|
24
16
|
attr_accessor max_retries: Integer
|
25
17
|
|
26
|
-
def initialize: (params: Hash[
|
18
|
+
def initialize: (params: Hash[String | Symbol, untyped]) -> void
|
27
19
|
end
|
28
20
|
|
29
21
|
class WorkflowOptions
|
@@ -33,19 +25,22 @@ module Mindee
|
|
33
25
|
attr_accessor rag: bool?
|
34
26
|
attr_accessor public_url: (String?)
|
35
27
|
attr_accessor page_options: (PageOptions)
|
28
|
+
attr_accessor close_file: bool
|
36
29
|
|
37
|
-
def initialize: (params: Hash[
|
30
|
+
def initialize: (params: Hash[String | Symbol, untyped]) -> void
|
38
31
|
end
|
39
32
|
|
40
33
|
class Client
|
34
|
+
@api_key: String?
|
35
|
+
|
41
36
|
def initialize: (?api_key: String) -> void
|
42
|
-
def logger: () ->
|
43
|
-
def parse: (Input::Source::LocalInputSource | Input::Source::URLInputSource,
|
44
|
-
def parse_sync: (Input::Source::LocalInputSource | Input::Source::URLInputSource,
|
45
|
-
def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource,
|
37
|
+
def logger: () -> Logging
|
38
|
+
def parse: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), ?endpoint: (HTTP::Endpoint?), options: ParseOptions | Hash[String | Symbol, untyped]) -> Parsing::Common::ApiResponse
|
39
|
+
def parse_sync: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse
|
40
|
+
def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), ?endpoint: (HTTP::Endpoint?), options: ParseOptions|Hash[String | Symbol, untyped]) -> Parsing::Common::ApiResponse
|
46
41
|
def parse_queued: (String, singleton(Parsing::Common::Inference), ?endpoint: HTTP::Endpoint?) -> Parsing::Common::ApiResponse
|
47
|
-
def enqueue_and_parse: (Input::Source::URLInputSource|Input::Source::LocalInputSource,
|
48
|
-
def execute_workflow: (Input::Source::URLInputSource|Input::Source::LocalInputSource, String, options: (Hash[
|
42
|
+
def enqueue_and_parse: (Input::Source::URLInputSource|Input::Source::LocalInputSource, singleton(Parsing::Common::Inference), HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse
|
43
|
+
def execute_workflow: (Input::Source::URLInputSource|Input::Source::LocalInputSource, String, options: (Hash[String | Symbol, untyped] | WorkflowOptions)) -> Parsing::Common::WorkflowResponse
|
49
44
|
def load_prediction: (singleton(Parsing::Common::Inference), Input::LocalResponse) -> Parsing::Common::ApiResponse
|
50
45
|
def source_from_path: (String, ?repair_pdf: bool) -> Input::Source::PathInputSource
|
51
46
|
def source_from_bytes: (String, String, ?repair_pdf: bool) -> Input::Source::BytesInputSource
|
@@ -55,7 +50,7 @@ module Mindee
|
|
55
50
|
def create_endpoint: (endpoint_name: String, account_name: String, version: String) -> HTTP::Endpoint
|
56
51
|
|
57
52
|
private
|
58
|
-
def normalize_parse_options: ((Hash[
|
53
|
+
def normalize_parse_options: ((Hash[String | Symbol, untyped] | ParseOptions)) -> ParseOptions
|
59
54
|
def process_pdf_if_required: (Input::Source::LocalInputSource, ParseOptions | WorkflowOptions) -> void
|
60
55
|
def initialize_endpoint: (singleton(Parsing::Common::Inference), ?endpoint_name: String, ?account_name: String, ?version: String) -> HTTP::Endpoint
|
61
56
|
def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# lib/mindee/client_v2.rb
|
2
|
+
|
3
|
+
OTS_OWNER: String
|
4
|
+
module Mindee
|
5
|
+
class ClientV2
|
6
|
+
attr_reader mindee_api: HTTP::MindeeApiV2
|
7
|
+
|
8
|
+
def logger: () -> Logger
|
9
|
+
def initialize: (?api_key: String) -> void
|
10
|
+
def get_inference: (String) -> Parsing::V2::InferenceResponse
|
11
|
+
def get_job: (String) -> Parsing::V2::JobResponse
|
12
|
+
def enqueue_inference: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Parsing::V2::JobResponse
|
13
|
+
def enqueue_and_get_inference: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Parsing::V2::InferenceResponse
|
14
|
+
def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void
|
15
|
+
def normalize_inference_parameters: (Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Input::InferenceParameters
|
16
|
+
end
|
17
|
+
end
|