Class: Mindee::Product::FR::BankStatement::BankStatementV1Transaction
- Inherits:
-
Mindee::Parsing::Standard::FeatureField
- Object
- Mindee::Parsing::Standard::AbstractField
- Mindee::Parsing::Standard::FeatureField
- Mindee::Product::FR::BankStatement::BankStatementV1Transaction
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb
Overview
The list of values that represent the financial transactions recorded in a bank statement.
Instance Attribute Summary collapse
-
#amount ⇒ Float
readonly
The monetary amount of the transaction.
-
#date ⇒ String
readonly
The date on which the transaction occurred.
-
#description ⇒ String
readonly
The additional information about the transaction.
Attributes inherited from Mindee::Parsing::Standard::AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BankStatementV1Transaction
constructor
A new instance of BankStatementV1Transaction.
- #printable_values ⇒ Hash
- #to_s ⇒ String
- #to_table_line ⇒ String
Methods inherited from Mindee::Parsing::Standard::FeatureField
Methods inherited from Mindee::Parsing::Standard::AbstractField
array_confidence, array_sum, float_to_string
Constructor Details
#initialize(prediction, page_id) ⇒ BankStatementV1Transaction
Returns a new instance of BankStatementV1Transaction.
24 25 26 27 28 29 30 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 24 def initialize(prediction, page_id) super(prediction, page_id) @amount = prediction['amount'] @date = prediction['date'] @description = prediction['description'] @page_id = page_id end |
Instance Attribute Details
#amount ⇒ Float (readonly)
The monetary amount of the transaction.
14 15 16 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 14 def amount @amount end |
#date ⇒ String (readonly)
The date on which the transaction occurred.
17 18 19 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 17 def date @date end |
#description ⇒ String (readonly)
The additional information about the transaction.
20 21 22 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 20 def description @description end |
Instance Method Details
#printable_values ⇒ Hash
33 34 35 36 37 38 39 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 33 def printable_values printable = {} printable[:amount] = @amount.nil? ? '' : Field.float_to_string(@amount) printable[:date] = format_for_display(@date, nil) printable[:description] = format_for_display(@description, 36) printable end |
#to_s ⇒ String
52 53 54 55 56 57 58 59 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 52 def to_s printable = printable_values out_str = String.new out_str << "\n :Amount: #{printable[:amount]}" out_str << "\n :Date: #{printable[:date]}" out_str << "\n :Description: #{printable[:description]}" out_str end |
#to_table_line ⇒ String
42 43 44 45 46 47 48 49 |
# File 'lib/mindee/product/fr/bank_statement/bank_statement_v1_transaction.rb', line 42 def to_table_line printable = printable_values out_str = String.new out_str << format('| %- 10s', printable[:amount]) out_str << format('| %- 11s', printable[:date]) out_str << format('| %- 37s', printable[:description]) out_str << '|' end |