Class: Mindee::Parsing::Common::Page
- Inherits:
-
Object
- Object
- Mindee::Parsing::Common::Page
- Defined in:
- lib/mindee/parsing/common/page.rb
Overview
Abstract wrapper class for prediction Pages Holds prediction for a page as well as it’s orientation and id.
Direct Known Subclasses
Mindee::Product::BarcodeReader::BarcodeReaderV1Page, Mindee::Product::BillOfLading::BillOfLadingV1Page, Mindee::Product::BusinessCard::BusinessCardV1Page, Mindee::Product::Cropper::CropperV1Page, Mindee::Product::Custom::CustomV1Page, Mindee::Product::DeliveryNote::DeliveryNoteV1Page, Mindee::Product::EU::DriverLicense::DriverLicenseV1Page, Mindee::Product::EU::LicensePlate::LicensePlateV1Page, Mindee::Product::FR::BankAccountDetails::BankAccountDetailsV1Page, Mindee::Product::FR::BankAccountDetails::BankAccountDetailsV2Page, Mindee::Product::FR::BankStatement::BankStatementV1Page, Mindee::Product::FR::CarteGrise::CarteGriseV1Page, Mindee::Product::FR::CarteVitale::CarteVitaleV1Page, Mindee::Product::FR::EnergyBill::EnergyBillV1Page, Mindee::Product::FR::IdCard::IdCardV1Page, Mindee::Product::FR::IdCard::IdCardV2Page, Mindee::Product::FR::Payslip::PayslipV2Page, Mindee::Product::FinancialDocument::FinancialDocumentV1Page, Mindee::Product::Generated::GeneratedV1Page, Mindee::Product::IND::IndianPassport::IndianPassportV1Page, Mindee::Product::InternationalId::InternationalIdV1Page, Mindee::Product::InternationalId::InternationalIdV2Page, Mindee::Product::Invoice::InvoiceV4Page, Mindee::Product::InvoiceSplitter::InvoiceSplitterV1Page, Mindee::Product::MultiReceiptsDetector::MultiReceiptsDetectorV1Page, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Page, Mindee::Product::Passport::PassportV1Page, Mindee::Product::ProofOfAddress::ProofOfAddressV1Page, Mindee::Product::Receipt::ReceiptV4Page, Mindee::Product::Receipt::ReceiptV5Page, Mindee::Product::Resume::ResumeV1Page, Mindee::Product::US::BankCheck::BankCheckV1Page, Mindee::Product::US::DriverLicense::DriverLicenseV1Page, Mindee::Product::US::HealthcareCard::HealthcareCardV1Page, Mindee::Product::US::UsMail::UsMailV2Page, Mindee::Product::US::W9::W9V1Page
Instance Attribute Summary collapse
-
#extras ⇒ Mindee::Parsing::Common::Extras::Extras
readonly
Additional page-level information.
-
#orientation ⇒ Mindee::Parsing::Common::Orientation
readonly
Orientation of the page.
-
#page_id ⇒ Integer
readonly
Id of the page (as given by the API).
-
#prediction ⇒ Mindee::Parsing::Common::Prediction
readonly
Page prediction.
Instance Method Summary collapse
-
#initialize(raw_prediction) ⇒ Page
constructor
A new instance of Page.
- #to_s ⇒ String
Constructor Details
#initialize(raw_prediction) ⇒ Page
Returns a new instance of Page.
27 28 29 30 31 |
# File 'lib/mindee/parsing/common/page.rb', line 27 def initialize(raw_prediction) @page_id = raw_prediction['id'] @orientation = Orientation.new(raw_prediction['orientation'], @page_id) @extras = Extras::Extras.new(raw_prediction['extras']) unless raw_prediction['extras'].nil? end |
Instance Attribute Details
#extras ⇒ Mindee::Parsing::Common::Extras::Extras (readonly)
Additional page-level information.
24 25 26 |
# File 'lib/mindee/parsing/common/page.rb', line 24 def extras @extras end |
#orientation ⇒ Mindee::Parsing::Common::Orientation (readonly)
Orientation of the page.
18 19 20 |
# File 'lib/mindee/parsing/common/page.rb', line 18 def orientation @orientation end |
#page_id ⇒ Integer (readonly)
Id of the page (as given by the API).
15 16 17 |
# File 'lib/mindee/parsing/common/page.rb', line 15 def page_id @page_id end |
#prediction ⇒ Mindee::Parsing::Common::Prediction (readonly)
Page prediction
21 22 23 |
# File 'lib/mindee/parsing/common/page.rb', line 21 def prediction @prediction end |
Instance Method Details
#to_s ⇒ String
34 35 36 37 38 39 40 41 |
# File 'lib/mindee/parsing/common/page.rb', line 34 def to_s out_str = String.new title = "Page #{@page_id}" out_str << "#{title}\n" out_str << ('-' * title.size) out_str << @prediction.to_s out_str end |