Class: Mindee::V1::Parsing::Common::Page
- Inherits:
-
Object
- Object
- Mindee::V1::Parsing::Common::Page
- Defined in:
- lib/mindee/v1/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::V1::Product::BarcodeReader::BarcodeReaderV1Page, Mindee::V1::Product::Cropper::CropperV1Page, Mindee::V1::Product::FR::BankAccountDetails::BankAccountDetailsV1Page, Mindee::V1::Product::FR::BankAccountDetails::BankAccountDetailsV2Page, Mindee::V1::Product::FR::BankStatement::BankStatementV2Page, Mindee::V1::Product::FR::IdCard::IdCardV1Page, Mindee::V1::Product::FR::IdCard::IdCardV2Page, Mindee::V1::Product::FinancialDocument::FinancialDocumentV1Page, Mindee::V1::Product::InternationalId::InternationalIdV2Page, Mindee::V1::Product::Invoice::InvoiceV4Page, Mindee::V1::Product::InvoiceSplitter::InvoiceSplitterV1Page, Mindee::V1::Product::MultiReceiptsDetector::MultiReceiptsDetectorV1Page, Mindee::V1::Product::Passport::PassportV1Page, Mindee::V1::Product::Receipt::ReceiptV5Page, Mindee::V1::Product::Resume::ResumeV1Page, Mindee::V1::Product::Universal::UniversalPage
Instance Attribute Summary collapse
-
#extras ⇒ Mindee::V1::Parsing::Common::Extras::Extras
readonly
Additional page-level information.
-
#orientation ⇒ Mindee::V1::Parsing::Common::Orientation
readonly
Orientation of the page.
-
#page_id ⇒ Integer
readonly
ID of the page (as given by the API).
-
#prediction ⇒ Mindee::V1::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.
28 29 30 31 32 33 34 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 28 def initialize(raw_prediction) @page_id = raw_prediction['id'] @orientation = Mindee::V1::Parsing::Common::Orientation.new(raw_prediction['orientation'], @page_id) return if raw_prediction['extras'].nil? @extras = Mindee::V1::Parsing::Common::Extras::Extras.new(raw_prediction['extras']) end |
Instance Attribute Details
#extras ⇒ Mindee::V1::Parsing::Common::Extras::Extras (readonly)
Additional page-level information.
25 26 27 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 25 def extras @extras end |
#orientation ⇒ Mindee::V1::Parsing::Common::Orientation (readonly)
Orientation of the page.
19 20 21 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 19 def orientation @orientation end |
#page_id ⇒ Integer (readonly)
ID of the page (as given by the API).
16 17 18 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 16 def page_id @page_id end |
#prediction ⇒ Mindee::V1::Parsing::Common::Prediction (readonly)
Page prediction
22 23 24 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 22 def prediction @prediction end |
Instance Method Details
#to_s ⇒ String
37 38 39 40 41 42 43 44 |
# File 'lib/mindee/v1/parsing/common/page.rb', line 37 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 |