mindee 4.6.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 +12 -0
- data/README.md +21 -222
- data/docs/code_samples/default_v2.txt +28 -0
- 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/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/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/universal/universal_list_field.rb +2 -2
- data/lib/mindee/parsing/universal/universal_object_field.rb +6 -3
- 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/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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +61 -6
@@ -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.
|
@@ -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.76'
|
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
|
@@ -2,11 +2,12 @@
|
|
2
2
|
module Mindee
|
3
3
|
module Errors
|
4
4
|
class MindeeHTTPError < Errors::MindeeError
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
attr_reader api_code: Integer
|
6
|
+
attr_reader api_details: String
|
7
|
+
attr_reader api_message: String
|
8
|
+
attr_reader status_code: Integer
|
9
|
+
|
10
|
+
def initialize: (Hash[String | Symbol, untyped], String, Integer) -> void
|
10
11
|
end
|
11
12
|
class MindeeHTTPClientError < MindeeHTTPError
|
12
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# lib/mindee/errors/mindee_http_error_v2.rb
|
2
|
+
module Mindee
|
3
|
+
module Errors
|
4
|
+
# API V2 HttpError
|
5
|
+
class MindeeHTTPErrorV2 < MindeeError
|
6
|
+
|
7
|
+
attr_reader detail: String
|
8
|
+
attr_reader status: Integer
|
9
|
+
def initialize: (Hash[String, untyped] | Parsing::V2::ErrorResponse) -> void
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -6,8 +6,9 @@ module Mindee
|
|
6
6
|
class MindeeSourceError < MindeeInputError
|
7
7
|
end
|
8
8
|
class MindeeMimeTypeError < MindeeSourceError
|
9
|
-
|
10
|
-
|
9
|
+
attr_reader invalid_mimetype: String
|
10
|
+
|
11
|
+
def initialize: (String) -> void
|
11
12
|
end
|
12
13
|
class MindeeImageError < MindeeInputError
|
13
14
|
end
|
@@ -2,12 +2,11 @@
|
|
2
2
|
module Mindee
|
3
3
|
module Geometry
|
4
4
|
class Point
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def
|
9
|
-
def
|
10
|
-
def []: (untyped) -> bot
|
5
|
+
attr_accessor x: Float
|
6
|
+
attr_accessor y: Float
|
7
|
+
|
8
|
+
def initialize: (Float, Float) -> void
|
9
|
+
def []: (Integer) -> Float
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# lib/mindee/geometry/polygon.rb
|
2
2
|
module Mindee
|
3
3
|
module Geometry
|
4
|
-
class Polygon < Array[
|
5
|
-
def centroid: ->
|
6
|
-
def point_in_y?: (
|
4
|
+
class Polygon < Array[Point]
|
5
|
+
def centroid: -> Point
|
6
|
+
def point_in_y?: (Point) -> bool
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -2,14 +2,11 @@
|
|
2
2
|
module Mindee
|
3
3
|
module Geometry
|
4
4
|
class Quadrilateral
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def bottom_right=: (Point) -> untyped
|
11
|
-
def bottom_left: -> Point
|
12
|
-
def bottom_left=: (Point) -> untyped
|
5
|
+
attr_accessor bottom_left: Point
|
6
|
+
attr_accessor bottom_right: Point
|
7
|
+
attr_accessor top_left: Point
|
8
|
+
attr_accessor top_right: Point
|
9
|
+
|
13
10
|
def initialize: (Point, Point, Point, Point) -> void
|
14
11
|
def []: (Integer) -> Point
|
15
12
|
def size: -> Integer
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# lib/mindee/geometry/utils.rb
|
2
2
|
module Mindee
|
3
3
|
module Geometry
|
4
|
-
def self.quadrilateral_from_prediction: (
|
5
|
-
def self.polygon_from_prediction: (
|
6
|
-
def self.get_bbox: (
|
7
|
-
def self.get_bounding_box: (
|
8
|
-
def self.get_centroid: (
|
9
|
-
def self.get_min_max_y: (
|
10
|
-
def self.get_min_max_x: (
|
11
|
-
def self.below?: (
|
4
|
+
def self.quadrilateral_from_prediction: (Array[Array[Float]]) -> Quadrilateral
|
5
|
+
def self.polygon_from_prediction: (Array[Array[Float]]) -> Polygon
|
6
|
+
def self.get_bbox: (Array[Point]) -> [Float, Float, Float, Float]
|
7
|
+
def self.get_bounding_box: (Array[Point]) -> Quadrilateral
|
8
|
+
def self.get_centroid: (Array[Point]) -> Point
|
9
|
+
def self.get_min_max_y: (Array[Point]) -> MinMax
|
10
|
+
def self.get_min_max_x: (Array[Point]) -> MinMax
|
11
|
+
def self.below?: (Array[Point], Array[Point], Float, Float) -> bool
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# lib/mindee/http/api_settings_v2.rb
|
2
|
+
module Mindee
|
3
|
+
module HTTP
|
4
|
+
class ApiSettingsV2
|
5
|
+
MINDEE_V2_API_KEY_ENV_NAME: String
|
6
|
+
MINDEE_V2_API_KEY_DEFAULT: String?
|
7
|
+
MINDEE_V2_BASE_URL_ENV_NAME: String
|
8
|
+
MINDEE_V2_BASE_URL_DEFAULT: String
|
9
|
+
MINDEE_V2_REQUEST_TIMEOUT_ENV_NAME: String
|
10
|
+
MINDEE_V2_TIMEOUT_DEFAULT: Integer
|
11
|
+
USER_AGENT: String
|
12
|
+
|
13
|
+
def logger: () -> Logger
|
14
|
+
attr_reader api_key: String?
|
15
|
+
attr_reader base_url: String
|
16
|
+
attr_reader request_timeout: Integer
|
17
|
+
attr_reader user_agent: String
|
18
|
+
|
19
|
+
def initialize: (?api_key: String?) -> void
|
20
|
+
def check_api_key: -> void
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,25 +2,26 @@
|
|
2
2
|
module Mindee
|
3
3
|
module HTTP
|
4
4
|
API_KEY_ENV_NAME: String
|
5
|
-
API_KEY_DEFAULT:
|
5
|
+
API_KEY_DEFAULT: String?
|
6
6
|
BASE_URL_ENV_NAME: String
|
7
7
|
BASE_URL_DEFAULT: String
|
8
8
|
REQUEST_TIMEOUT_ENV_NAME: String
|
9
9
|
TIMEOUT_DEFAULT: Integer
|
10
10
|
USER_AGENT: String
|
11
11
|
class Endpoint
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def
|
18
|
-
def
|
19
|
-
def
|
20
|
-
def
|
12
|
+
attr_reader api_key: String
|
13
|
+
attr_reader base_url: String
|
14
|
+
attr_reader request_timeout: Integer
|
15
|
+
attr_reader url_root: String
|
16
|
+
|
17
|
+
def logger: () -> Logger
|
18
|
+
def initialize: (String, String, String?, ?api_key: String) -> String
|
19
|
+
def predict: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Hash[String | Symbol, untyped], String]
|
20
|
+
def predict_async: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Hash[String | Symbol, untyped], String]
|
21
|
+
def parse_async: (String) -> [Hash[String | Symbol, untyped], String]
|
21
22
|
def predict_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse
|
22
23
|
def document_queue_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse
|
23
|
-
def document_queue_req_get: (
|
24
|
+
def document_queue_req_get: (String) -> Net::HTTPResponse
|
24
25
|
def check_api_key: -> void
|
25
26
|
end
|
26
27
|
end
|
@@ -2,9 +2,14 @@
|
|
2
2
|
module Mindee
|
3
3
|
module HTTP
|
4
4
|
module ErrorHandler
|
5
|
-
def extract_error: (untyped) ->
|
6
|
-
def create_error_obj: (untyped) ->
|
7
|
-
def self.
|
5
|
+
def extract_error: (Hash[String | Symbol, untyped]) -> Hash[String | Symbol, untyped]?
|
6
|
+
def create_error_obj: (Hash[String | Symbol, untyped]) -> Hash[String | Symbol, untyped]
|
7
|
+
def self.generate_v2_error: (Hash[String, Integer | String]) -> Errors::MindeeHTTPErrorV2
|
8
|
+
def generate_v2_error: (Hash[Symbol, String | Integer]) -> Errors::MindeeHTTPErrorV2
|
9
|
+
|
10
|
+
def self.handle_error: (String, Net::HTTPResponse) -> Errors::MindeeHTTPError
|
11
|
+
def handle_error: (String, Net::HTTPResponse) -> Errors::MindeeHTTPError
|
12
|
+
def handle_v2_error: (Hash[String | Symbol, untyped]) -> void
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# lib/mindee/http/mindee_api_v2.rb
|
2
|
+
module Mindee
|
3
|
+
module HTTP
|
4
|
+
class MindeeApiV2
|
5
|
+
attr_reader settings: ApiSettingsV2
|
6
|
+
|
7
|
+
def initialize: (?api_key: String?) -> void
|
8
|
+
def req_post_inference_enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Input::InferenceParameters) -> Parsing::V2::JobResponse
|
9
|
+
def req_get_inference: (String) -> Parsing::V2::InferenceResponse
|
10
|
+
def req_get_job: (String) -> Parsing::V2::JobResponse
|
11
|
+
def process_response: (Net::HTTPResponse?) -> Hash[String | Symbol, untyped]
|
12
|
+
def poll: (String) -> Net::HTTPResponse
|
13
|
+
def inference_job_req_get: (String) -> Net::HTTPResponse
|
14
|
+
def inference_result_req_get: (String) -> Net::HTTPResponse
|
15
|
+
def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Input::InferenceParameters) -> Net::HTTPResponse?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -3,6 +3,7 @@ module Mindee
|
|
3
3
|
module HTTP
|
4
4
|
module ResponseValidation
|
5
5
|
def self.valid_sync_response?: (Net::HTTPResponse) -> bool
|
6
|
+
def self.valid_v2_response?: (Net::HTTPResponse) -> bool
|
6
7
|
def self.valid_async_response?: (Net::HTTPResponse) -> bool
|
7
8
|
def self.clean_request!: (Net::HTTPResponse) -> void
|
8
9
|
end
|
@@ -10,7 +10,7 @@ module Mindee
|
|
10
10
|
|
11
11
|
def initialize: (untyped, ?api_key: String) -> String
|
12
12
|
|
13
|
-
def execute_workflow: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> [
|
13
|
+
def execute_workflow: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> [Hash[String, untyped], String]
|
14
14
|
|
15
15
|
def workflow_execution_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> Net::HTTPResponse?
|
16
16
|
|
@@ -2,13 +2,13 @@
|
|
2
2
|
module Mindee
|
3
3
|
module Image
|
4
4
|
class ExtractedImage
|
5
|
-
def logger: () ->
|
5
|
+
def logger: () -> Logger
|
6
6
|
def page_id: -> Integer
|
7
7
|
def element_id: -> Integer
|
8
8
|
def buffer: -> StringIO
|
9
9
|
def internal_file_name: -> String
|
10
10
|
def initialize: (Input::Source::LocalInputSource, Integer, Integer) -> Integer
|
11
|
-
def write_to_file: (String, ?String?) ->
|
11
|
+
def write_to_file: (String, ?String?) -> void
|
12
12
|
def as_source: -> Input::Source::BytesInputSource
|
13
13
|
end
|
14
14
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Mindee
|
3
3
|
module Image
|
4
4
|
module ImageCompressor
|
5
|
-
def self.compress_image: (
|
5
|
+
def self.compress_image: (MiniMagick::Image | StringIO | File, ?quality: Integer | Float?, ?max_width: Integer | Float?, ?max_height: Integer | Float?) -> StringIO
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|